Search code examples
sqlalchemyalembic

How to change timezone in alembic for sqlalchemy?


I am creating a FastApi web app and I want to change the timezone to UTC, the problem is whatever I put at the timezone line in the alembic.ini file it shows an error. I tried to check Alembic tutorial it didn't help either because it is a little ambiguous to me how to change it.

The console always shows this error.

INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
.
.
.
ERROR [alembic.util.messaging] Can't locate timezone: UTC
FAILED: Can't locate timezone: UTC

I want to make it shows UTC timezone always.


Solution

  • I found the answer there was a missing package called tzdata. It contains the info for all time zones. I used Wikipedia's list of timezones to get a prettified list for all the timezones