2017-10-04 73 views
1

我嘗試連接到我的Python應用程序中的Postgres數據庫。 我使用psycopg2庫。從psycopg2的模式獲取數據

如果我執行select語句是這樣的:

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

,我也得到:

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

,但如果我執行語句

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

我得到錯誤

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

有什麼可能是錯的?

回答