2

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

enter image description here

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'

enter image description here

I'm using Windows 8.1, have created a database using PostgreSQL, trying to access the indexed Landsat 8 data.

2
  • You seem to have very old version of Datacube installed 0.0.0 ? As opposed to the latest 1.8.3. pypi.org/project/datacube. Could you also check DB connection via psql and if CLI commands like datacube product list work ? – whatnick Jul 18 at 23:24
  • @whatnick I installed the latest version of Datacube, but still, getting the same errors. Also, I am able to connect to the database via psql, but datacube product list shows no output at all. – Badal Jul 19 at 13:45
0

I solve this problem. Turns out I was not indexing data to Open Data Cube in the proper way.

Please see this post.

New contributor
Badal is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.