pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.76k stars 297 forks source link

TIMESTAMPTZ Datatype for PostgreSQL #378

Closed naga-9 closed 2 years ago

naga-9 commented 3 years ago

Hi, How can I create a column with datatype of TIMESTAMPTZ (in PostgreSQL).

I tried using this: table.create_column('datetime', db.types.TIMESTAMPTZ)

But its giving error: AttributeError: 'Types' object has no attribute 'TIMESTAMPTZ'

What is the right way?

Thanks.

pudo commented 3 years ago

I don't have much experience with TIMESTAMPTZ, but judging from this SO answer you should be able to do this:

from sqlalchemy import DateTime

table.create_column('datetime', DateTime(timezone=True))

Can you confirm?

pudo commented 2 years ago

assuming fixed.