You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reflecting the table schema, the timezone setting is always set to False on a TIMESTAMP column. It should be set to True for duckdbTIMESTAMPTZ columns. Script to reproduce below:
import os
import duckdb
import os
from sqlalchemy import create_engine, MetaData
if __name__ == "__main__":
if os.path.exists("input.db"):
os.remove("input.db")
print("Removed existing input.db")
# populate duckdb database with sample data
conn = duckdb.connect("input.db")
conn.execute("CREATE SCHEMA raw")
conn.execute("""
CREATE TABLE raw.sample_table (
id INTEGER,
name TEXT,
created_at TIMESTAMP,
created_at_tz TIMESTAMPTZ
)
""")
conn.execute("""
INSERT INTO raw.sample_table VALUES
(1, 'Alice', '2024-04-01 10:00:00', '2024-04-01 10:00:00+00'),
(2, 'Bob', '2024-04-02 11:30:00', '2024-04-02 11:30:00+00'),
(3, 'Charlie', '2024-04-03 14:15:00', '2024-04-03 14:15:00+00'),
(4, 'Diana', '2024-04-04 09:45:00', '2024-04-04 09:45:00+00'),
(5, 'Eve', '2024-04-05 16:20:00', '2024-04-05 16:20:00+00')
""")
conn.close()
engine = create_engine("duckdb:///input.db")
metadata = MetaData()
metadata.reflect(bind=engine)
# Get the Table object
table = metadata.tables["sample_table"]
# Get the list of Column objects
columns = list(table.columns)
for c in columns:
if c.name in ["created_at", "created_at_tz"]:
print(c.name)
print(c.type)
print(c.type.timezone)
DuckDB Engine Version
0.17.0
DuckDB Version
1.2.0
SQLAlchemy Version
Both 1.4 and 2.0.48
Relevant log output
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
When reflecting the table schema, the timezone setting is always set to
False
on aTIMESTAMP
column. It should be set toTrue
forduckdb
TIMESTAMPTZ
columns. Script to reproduce below:DuckDB Engine Version
0.17.0
DuckDB Version
1.2.0
SQLAlchemy Version
Both 1.4 and 2.0.48
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: