Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: another duckdb type - null (#7320)

Myles Scolnick75ac90caa197
diff --git a/marimo/_data/get_datasets.py b/marimo/_data/get_datasets.py
index f077359e22..816c66605a 100644
--- a/marimo/_data/get_datasets.py
+++ b/marimo/_data/get_datasets.py
@@ -526,6 +526,9 @@ def _db_type_to_data_type(db_type: str) -> DataType:
# Geometry types
if db_type == "geometry":
return "unknown"
+ # Null type (can occur when attaching databases or with unknown column types)
+ if db_type == "null" or db_type == '"null"':
+ return "unknown"
LOGGER.warning("Unknown DuckDB type: %s", db_type)
# Unknown type
diff --git a/tests/_data/test_get_datasets.py b/tests/_data/test_get_datasets.py
index 9d46a3f839..6852c7f717 100644
--- a/tests/_data/test_get_datasets.py
+++ b/tests/_data/test_get_datasets.py
@@ -6,6 +6,7 @@ from typing import Any
import pytest
from marimo._data.get_datasets import (
+ _db_type_to_data_type,
get_databases_from_duckdb,
get_datasets_from_variables,
get_duckdb_databases_agg_query,
@@ -612,3 +613,38 @@ def test_get_databases_with_context_manager_closed_connection() -> None:
# Should return empty list for closed connection
assert result == []
+
+
+def test_db_type_to_data_type_null() -> None:
+ """Test that the 'null' DuckDB type is handled without warnings."""
+ # Test that null type maps to unknown
+ assert _db_type_to_data_type("null") == "unknown"
+ assert _db_type_to_data_type("NULL") == "unknown"
+ assert _db_type_to_data_type('"null"') == "unknown"
+
+
+def test_db_type_to_data_type_various() -> None:
+ """Test various DuckDB type mappings."""
+ # Integer types
+ assert _db_type_to_data_type("integer") == "integer"
+ assert _db_type_to_data_type("bigint") == "integer"
+
+ # Numeric types
+ assert _db_type_to_data_type("float") == "number"
+ assert _db_type_to_data_type("double") == "number"
+
+ # String types
+ assert _db_type_to_data_type("varchar") == "string"
+ assert _db_type_to_data_type("text") == "string"
+
+ # Boolean
+ assert _db_type_to_data_type("boolean") == "boolean"
+
+ # Date/Time
+ assert _db_type_to_data_type("date") == "date"
+ assert _db_type_to_data_type("timestamp") == "datetime"
+
+ # Special types
+ assert _db_type_to_data_type("geometry") == "unknown"
+ assert _db_type_to_data_type("null") == "unknown"
+ assert _db_type_to_data_type("json") == "unknown"