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

How to insert arrays into ARRAY<STRING> columns using native parameters?

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

還沒有人認領這個 Issue。

評估

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

研究方向

從 docs/parameters.md 中 named parameters 的使用範例開始,並使用提供的資料表定義、連接器版本和資料重現 insert_test()。檢查 SQL Warehouse 查詢歷程記錄,將繫結的 categories 值與預期的字串陣列進行比較;當插入的資料列包含兩個 category 值而不是 [] 時,即表示完成。

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

描述

Hi!

I am trying to insert an string array into a table with an ARRAY column, but it doesn't seem to register my Python string list.

CREATE TABLE prod_catalog.eu_projects.project_export (project_id bigint, categories ARRAY<STRING>);
def insert_test():
    data = {
        "project_id": 123456,
        "categories": [
            "Public Sector",
            "Healthcare",
        ],
    }
    with get_databricks_connection() as connection:
        cursor = connection.cursor()
        cursor.execute(
            "INSERT INTO prod_catalog.eu_projects.project_export(project_id, categories) VALUES (:project_id, Array(:categories))",
            data
        )
        print("Test insert completed.")

This ends up as an empty array. If I check query history on the SQL Warehouse, it says that categories was an empty array []

I have tried to read the documentation, but it is very confusing.

I am using the following versions
Python 3.13.7
databricks-sql-connector==4.1.3
databricks-sdk==0.66.0

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