Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Double Parenthesis in Query Interpolation with List Parameters for IN clause

未關閉
#307 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python, sql

研究方向

首先,使用 issue 中所示的 Python connector 和清單參數重現查詢範本,然後將產生的 SQL 與預期形式和實際形式進行比較。判定插值行為如何與所述的 Snowflake connector 要求互相作用;完成的標準是 Databricks 查詢有效,且不會破壞文件中所述的相容性行為。

由索引模型根據 Issue 內容生成。

描述

Summary:
When using the Databricks SQL Python integration to interpolate list parameters into a SQL query, the list parameters are incorrectly wrapped in double parentheses. This results in a malformed SQL query, causing execution errors on the Databricks side.

Details:
I encountered an issue while using the Databricks SQL Python integration to dynamically inject a list of values into a SQL query. The expected behavior is to interpolate the list parameters into the query, properly formatted for an IN clause. However, the interpolation wraps the list in an extra set of parentheses, leading to a Databricks runtime error.

Query template

query = """
select *
from SOME_TABLE
where ID IN (%(id_list)s)
"""
parameters = {'id_list': [1, 2, 3]}
# Interpolation process here

Expected:

select *
from SOME_TABLE
where ID IN (1, 2, 3)

Actual:

select *
from SOME_TABLE
where ID IN ((1, 2, 3))

I know that removing outer parathesis will solve the error, but the same query is used by Snowflake connector which requires lists to be wrapped in parenthesis.

By the way, it might be the other way around and I might need to submit bug to Snowflake community.
Let me know what you think.

主要語言
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 摘要。