support new Cursor attribute that provides information on completed commands
还没有人认领这个 Issue。
评估
调研方向
从 dbt-databricks 中的 DatabricksConnectionManager.get_response() 开始,该 issue 指出了硬编码的 "OK" 消息,并检查 connector 的 cursor 和命令结果处理。将期望的输出与 PostgreSQL 的 CommandComplete 标签以及列出的驱动程序属性进行比较。完成标准是:已完成的命令会公开一个适当的 cursor 属性,并且 get_response() 会报告操作和受影响的行数。
由索引模型根据 Issue 内容生成。
描述
similar to: https://github.com/aws/amazon-redshift-python-driver/issues/220
While a Cursor attribute providing SQL State Code is not officially a part of PEP 249: Python DB API 2.0 spec, it's a common enough convention and would greatly enhance the user experience of dbt-databricks users (👀 @benc-db)
Many database drivers provide this as a Cursor attribute, dbt was able to depend on these drivers to provide it for a ConnectionManager.get_response() method, which reports to users after successful queries the kind of operation performed (SELECT, INSERT, CREATE) and the numbers of rows affected.
However, this is not fully supported today in dbt-databrick, see DatabricksConnectionManager.get_response() where message is hardcoded as "OK" instead of returning more information.
Support for SQL state amongst popular analytics database drivers
| Driver | Cursor attribute (docs) |
|---|---|
| psycopg2 | statusmessage |
snowflake-connector-python |
sqlstate |
Ideal implementation
Follow Postgres's CommandComplete message
| Command | Tag | rows indicates the number of rows |
|---|---|---|
INSERT |
INSERT 0 rows |
inserted |
DELETE |
DELETE rows |
deleted |
UPDATE |
UPDATE rows |
updated |
MERGE |
MERGE rows |
inserted, updated, or deleted |
SELECT / CREATE TABLE AS |
SELECT rows |
retrieved |
MOVE |
MOVE rows |
ursor's position has been changed by |
FETCH |
FETCH rows |
that have been retrieved from the cursor |
COPY |
COPY rows |
copied, only in PostgreSQL 8.2 and later |
- 主要语言
- Python
- 星标
- 233
- 派生
- 152
- 平均合并
- 21 小时 5 分钟
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
databricks/databricks-sql-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 84/100
查看 databricks/databricks-sql-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
-
难度 2/5 1-3 小时 新手友好度 84/100
PolicyEngine/policyengine-us#9559 ·
-
priority: p3
难度 2/5 1-3 小时 新手友好度 72/100
googleapis/librarian#7636 ·
-
from:qa priority:P2 reliability tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
spec-kitty/spec-kitty#4874 ·
-
难度 2/5 1-3 小时 新手友好度 68/100