Getting data from schema in psycopg2

Viewed 2004

I try to connect to Postgres database inside my Python app. I use psycopg2 library.

If I execute select statement like this:

cursor.execute("""select schema_name from information_schema.schemata;""")
rows = cursor.fetchall()
print(rows)

and I get :

[('DB_FZ',), ('DB_FZ_TEMP',), ...]

but if I execute statement

cursor.execute("""select * from DB_FZ.d_results;""")
rows = cursor.fetchall()
print(rows)

I get error

psycopg2.ProgrammingError: schema "db_fz" does not exist
LINE 1: select * from DB_FZ.d_results;

What could be wrong?

1 Answers
Related