database - Heroku Postgres:psycopg2.ProgrammingError:没有要获取的结果
问题描述
我正在从我的树莓派连接到托管在 heroku 上的 postgres,但是每当我尝试使用它运行查询时,psycopg2
我只得到错误。我已经用谷歌搜索了一堆错误,但没有一个是真正相关的。任何帮助将不胜感激。(出于明显的原因,我编辑了连接信息)
我的代码:
import psycopg2
connection = psycopg2.connect("""dbname={REDACTED}
host={REDACTED}
port={REDACTED}
user={REDACTED}
password={REDACTED}
sslmode=require
""")
cursor = connection.cursor()
data = cursor.fetchone()
print("Connection Established With: ", data)
connection.commit()
connection.close()
错误:
psycopg2.ProgrammingError: no results to fetch
解决方案
推荐阅读
- powerbi - PowerBi 计算的度量不受类别的影响
- c++ - 如何从组合框发出信号
- c++ - 为什么我的 Qt 程序在断言失败后继续运行?
- java - 在 android studio 中更改 build sdk 时出错
- ruby - watir 是否被阻止登录 Facebook?如果是这样,是否有另一种宝石可以做到这一点?
- c++ - 无法从 cso 文件创建顶点着色器(从 fx 文件创建)
- email - 有没有办法实现匿名电子邮件?
- python - 逆傅立叶不清晰数据
- reactjs - 如何在 useCallback 中使用全局对象而不将其作为依赖项(删除警告)
- python - 事件未定义?