My understanding is that you want to read in all of the pixel values of a single band so that you access them with x and y values. I would do this by getting the entire band as a numpy array, then use the x and y indices of the array:
band_id = 1 # this assumes you want the first band, change to match the band number you want
raster = rasterio.open('.../g.tif')
band_arr = raster.read(band_id) # band_arr is a numpy array of shape (raster.width, raster.height)
If you then want to get the pixel value at specific
pixel_value = band_arr[x, y]
OP's comment: I want to have a array of all pixels coordinates and pixels value. because i want to insert in a database.
OK. Beginning with
band_arr from above:
px_vals = 
for x in range(band_arr.shape):
for y in range(band_arr.shape):
'value': band_arr[x, y]})
The above will give you a
dicts with keys
'value' which you could then insert into the database.