Inconsistent behavior listing schemas in UC catalogs depending on quoting

未关闭
#245 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python, sql
领域
databases

调研方向

首先使用 Python 示例复现该问题,并检查 cursor.schemas API 入口点。将 schemas('dev') 和 schemas('dev') 的结果与包含 default 和 my_schema 的目录进行比较;完成的标准是两种形式都返回相同的 schema 行,包括 global_temp。

由索引模型根据 Issue 内容生成。

描述

With a dev catalog containing default and my_schema schemas, I get different results depending on the name quoting:

import os
from databricks import sql

host = os.getenv("DATABRICKS_HOST")
http_path = os.getenv("DATABRICKS_HTTP_PATH")
access_token = os.getenv("DATABRICKS_TOKEN")

connection = sql.connect(
  server_hostname=host,
  http_path=http_path,
  access_token=access_token)

cursor = connection.cursor()

print("> schemas('`dev`')")
cursor.schemas('`dev`')  # quoted name, I get (global_temp) only
result = cursor.fetchall()
for row in result:
  print(row)

print("> schemas('dev')")
cursor.schemas('dev')  # unquoted name, I get (default, my_schema, global_temp)
result = cursor.fetchall()
for row in result:
  print(row)

cursor.close()
connection.close()

I'd expect the same behavior for both, since this is what dbt-databricks is apparently expecting too.
A unwanted side effect for dbt-databricks is https://github.com/databricks/dbt-databricks/issues/464

主要语言
Python
星标
233
派生
152
平均合并
21 小时 5 分钟
30 天内合并 PR
10

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

databricks/databricks-sql-python 的其他 Issue

查看 databricks/databricks-sql-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。