Skip to content

Commit

Permalink
Merge pull request #1007 from Mause/1004-bug-interval-columns-compile…
Browse files Browse the repository at this point in the history
…-to-timestamp-without-time-zone

fix: use native interval support
  • Loading branch information
Mause authored Jun 2, 2024
2 parents 60ca9d3 + 1d84daa commit 845ece6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion duckdb_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ class Dialect(PGDialect_psycopg2):
# the psycopg2 driver registers a _PGNumeric with custom logic for
# postgres type_codes (such as 701 for float) that duckdb doesn't have
sqltypes.Numeric: sqltypes.Numeric,
sqltypes.Interval: sqltypes.Interval,
sqltypes.JSON: sqltypes.JSON,
UUID: UUID,
},
Expand Down
9 changes: 9 additions & 0 deletions duckdb_engine/tests/test_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

from packaging.version import Version
from pytest import importorskip, mark
from snapshottest.module import SnapshotTest
from sqlalchemy import (
Column,
Integer,
Interval,
MetaData,
Sequence,
String,
Table,
inspect,
schema,
select,
text,
)
Expand Down Expand Up @@ -206,3 +209,9 @@ class Entry(base):

assert result.struct == struct_data
assert result.map == map_data


def test_interval(engine: Engine, snapshot: SnapshotTest) -> None:
test_table = Table("test_table", MetaData(), Column("duration", Interval))

assert "duration INTERVAL" in str(schema.CreateTable(test_table).compile(engine))

0 comments on commit 845ece6

Please sign in to comment.