我连接到一个SQL数据库(heroku),我可以在那里创建一个表。在
当插入一些信息时,我没有发现任何错误。 但当我想读取数据时,它返回“None”。 我做错什么了?在
import pg8000
conn = pg8000.connect(user="username", password="password",
host="hostAddress", port=5432, database="database",
ssl=True)
cursor = conn.cursor()
def createTable():
cursor.execute("create table test (ID INT, TITLE TEXT)")
conn.commit()
def dataEntry():
cursor.execute("INSERT INTO test VALUES(1, 'blablabla')")
conn.commit()
def readTable():
print (cursor.execute("SELECT * FROM test "))
#createTable()
dataEntry()
readTable()
非常感谢你的帮助!在
基本上,错误是对结果的预测。。在
表格创建正确, 但是相反:
正在做:
^{pr2}$那就行了。。在
相关问题 更多 >
编程相关推荐