I am trying to access the product added in Open Data Cube database through Jupyter notebook. I'm using this demo notebook. But I'm not able to connect to the database. The below line showing the error.
dc = datacube.Datacube(app = 'my_app', config = 'C:/Program Files/PostgreSQL/13/data/datacube.conf')
The error is,
OperationalError: (psycopg2.OperationalError) could not translate host name "'localhost' db_username: postgres db_password: Metamorphosis" to address: Unknown host
As a workaround, I have tried to connect to the database manually, with the following commands which didn't produce any error.
import datacube import psycopg2 conn = psycopg2.connect(database="datacube", user="postgres", password="Metamorphosis") dc = datacube.Datacube(conn)
But after this, when I'm trying to list the products, present on the database with
list_of_products = dc.list_products() command, I'm getting error as,
AttributeError: 'psycopg2.extensions.connection' object has no attribute 'products'
I'm using Windows 8.1, have created a database using PostgreSQL, trying to access the indexed Landsat 8 data.