`Cursor().description` reports NULL (VOID) and INTERVAL fields as `'string'`
@susodapop is already working on this.
Since Jan 29, 2024.
Assessment
This issue has not been assessed yet.
Description
When querying NULL or INTERVAL columns from a Databricks SQL warehouse, the connector Cursor().description property reports the type code of the columns as a 'string'. If I understand things correctly, I'd have expected it to return 'void' and 'interval', reflecting the underlying data type in Databricks SQL.
There is no definition for VOID and INTERVAL types here.
Minimal code example:
from databricks import sql
with sql.connect(
server_hostname = os.getenv("DATABRICKS_HOST"),
http_path = os.getenv("DATABRICKS_HTTP_PATH"),
access_token = os.getenv("DATABRICKS_TOKEN"),
) as connection:
with connection.cursor() as cursor:
cursor.execute("SELECT NULL, CAST(NULL AS VOID), INTERVAL '13' MONTH")
print(cursor.description)
print(cursor.fetchall())
print(cursor.description)
[('NULL', 'string', None, None, None, None, None), ('CAST(NULL AS VOID)', 'string', None, None, None, None, None), ("INTERVAL '13' MONTH", 'string', None, None, None, None, None)]
[Row(NULL=None, CAST(NULL AS VOID)=None, INTERVAL '13' MONTH='1-1')]
[('NULL', 'string', None, None, None, None, None), ('CAST(NULL AS VOID)', 'string', None, None, None, None, None), ("INTERVAL '13' MONTH", 'string', None, None, None, None, None)]
- Dominant language
- Python
- Stars
- 233
- Forks
- 152
- Avg merge
- 21h 5m
- Merged PRs (30d)
- 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databricks/databricks-sql-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
All issues in databricks/databricks-sql-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·