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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: add more time types for duckdb (#5703)
Shahmir Varqha63e31a324505
diff --git a/marimo/_data/get_datasets.py b/marimo/_data/get_datasets.pyindex 38cb31b545..7db5ad7fb6 100644--- a/marimo/_data/get_datasets.py+++ b/marimo/_data/get_datasets.py@@ -242,6 +242,9 @@ def _get_duckdb_database_names(def _db_type_to_data_type(db_type: str) -> DataType:+ """Convert a DuckDB type to a Marimo data type.+ Reference: https://duckdb.org/docs/stable/sql/data_types/overview+ """db_type = db_type.lower()# Numeric typesif db_type in [@@ -287,16 +290,9 @@ def _db_type_to_data_type(db_type: str) -> DataType:# Date and Time typesif db_type == "date":return "date"- if db_type == "time":+ if db_type in ["time", "time with time zone"]:return "time"- if db_type in [- "timestamp",- "timestamp_ns",- "timestamp with time zone",- "timestamptz",- "datetime",- "interval",- ]:+ if db_type in ["datetime", "interval"] or db_type.startswith("timestamp"):return "datetime"# Nested typesif "[]" in db_type:diff --git a/tests/_data/test_get_datasets.py b/tests/_data/test_get_datasets.pyindex bad054eb2f..756dc78443 100644--- a/tests/_data/test_get_datasets.py+++ b/tests/_data/test_get_datasets.py@@ -43,6 +43,7 @@ CREATE TABLE all_types (col_varchar VARCHAR,col_date DATE,col_time TIME,+ col_timetz TIMETZ,col_timestamp TIMESTAMP,col_interval INTERVAL,col_blob BLOB,@@ -56,6 +57,7 @@ CREATE TABLE all_types (col_text TEXT,col_string STRING,col_timestamp_ns TIMESTAMP_NS,+ col_timestamp_ms TIMESTAMP_MS,col_timestamptz TIMESTAMPTZ,col_datetime DATETIME,col_array INTEGER[],@@ -79,7 +81,7 @@ all_types_tables = [source_type="duckdb",source="memory",num_rows=None,- num_columns=37,+ num_columns=39,variable_name=None,columns=[DataTableColumn(@@ -178,6 +180,12 @@ all_types_tables = [external_type="TIME",sample_values=[],),+ DataTableColumn(+ name="col_timetz",+ type="time",+ external_type="TIME WITH TIME ZONE",+ sample_values=[],+ ),DataTableColumn(name="col_timestamp",type="datetime",@@ -256,6 +264,12 @@ all_types_tables = [external_type="TIMESTAMP_NS",sample_values=[],),+ DataTableColumn(+ name="col_timestamp_ms",+ type="datetime",+ external_type="TIMESTAMP_MS",+ sample_values=[],+ ),DataTableColumn(name="col_timestamptz",type="datetime",