Traceback (most recent call last):
File "/path/to/.venv/bin/alembic", line 8, in <module>
sys.exit(main())
~~~~^^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/config.py", line 636, in main
CommandLine(prog=prog).main(argv=argv)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/config.py", line 626, in main
self.run_cmd(cfg, options)
~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/config.py", line 603, in run_cmd
fn(
~~^
config,
^^^^^^^
*[getattr(options, k, None) for k in positional],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**{k: getattr(options, k, None) for k in kwarg},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/command.py", line 243, in revision
scripts = [script for script in revision_context.generate_scripts()]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/autogenerate/api.py", line 650, in generate_scripts
yield self._to_script(generated_revision)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/autogenerate/api.py", line 555, in _to_script
return self.script_directory.generate_revision(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
migration_script.rev_id,
^^^^^^^^^^^^^^^^^^^^^^^^
...<7 lines>...
**template_args,
^^^^^^^^^^^^^^^^
)
^
File "/path/to/.venv/lib/python3.13/site-packages/alembic/script/base.py", line 693, in generate_revision
create_date = self._generate_create_date()
File "/path/to/.venv/lib/python3.13/site-packages/alembic/script/base.py", line 632, in _generate_create_date
datetime.datetime.utcnow()
~~~~~~~~~~~~~~~~~~~~~~~~^^
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
Alembic should succeed.
alembic -c test.ini revision --autogenerate -m "Add column"
in a local Python 3.13 environment.
See above.
I’ve not modified a warnings filter, so I’m a little surprised that the deprecation warning fails Alembic.
Describe the bug
This use of
utcnow()alembic/alembic/script/base.py
Lines 631 to 635 in 41198bb
Expected behavior
Alembic should succeed.
To Reproduce
I ran
in a local Python 3.13 environment.
Error
See above.
Versions.
Additional context
I’ve not modified a warnings filter, so I’m a little surprised that the deprecation warning fails Alembic.