Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AttributeError:get_表_Python_Postgresql_Pygresql - Fatal编程技术网

Python AttributeError:get_表

Python AttributeError:get_表,python,postgresql,pygresql,Python,Postgresql,Pygresql,这个代码有什么问题?应该显示表的列表 import pg con = pg.connect(dbname='xxx', host='xxxx', user='xxx') pgqueryset = con.get_tables() get_tables位于DB类上,该类使用与connect()相同的参数初始化: 尝试: 我对postgres不太熟悉,但从文档中可以看出,get\u tables是用于DB对象的方法,而不是pgobject连接对象。 Traceback (most recent

这个代码有什么问题?应该显示表的列表

import pg

con = pg.connect(dbname='xxx', host='xxxx', user='xxx')
pgqueryset = con.get_tables()


get_tables位于DB类上,该类使用与connect()相同的参数初始化:

尝试:


我对postgres不太熟悉,但从文档中可以看出,
get\u tables
是用于
DB
对象的方法,而不是
pgobject
连接对象。
Traceback (most recent call last):
  File "demo.py", line 42, in <module>
    pgqueryset = con.get_tables()()
AttributeError: get_tables
Parameters:
None
Returns:
list:   all tables in connected database
db = pg.DB(dbname='xxx', host='xxxx', user='xxx')
pgqueryset = db.get_tables()