Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@excavator-matt

Description

@excavator-matt
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.