igorbenav / fastcrud

FastCRUD is a Python package for FastAPI, offering robust async CRUD operations and flexible endpoint creation utilities.
MIT License
530 stars 32 forks source link

Add Warning in Docs that only timezone aware data is supported #92

Closed mithun2003 closed 1 month ago

mithun2003 commented 1 month ago

sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.DataError'>: invalid input for query argument $3: datetime.datetime(2024, 5, 22, 8, 11, 40... (can't subtract offset-naive and offset-aware datetimes) [SQL: UPDATE platform SET is_active=$1::BOOLEAN, is_live=$2::BOOLEAN, updated_at=$3::TIMESTAMP WITHOUT TIME ZONE WHERE platform.id = $4::INTEGER] [parameters: (True, True, datetime.datetime(2024, 5, 22, 8, 11, 40, 307132, tzinfo=datetime.timezone.utc), 2)]

showing this error when i try to update my table. The issue i think is in my tables the field updated_at didn't require timezone but the update code in fastcrud adding timezone in it so how to avoid that?

igorbenav commented 1 month ago

We don't support datetime without timezone since it's deprecated:

https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated

If that's actually the issue, just change it to timezone aware date