]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
3 days agofix(typings): improve typing for server_default
Sebastian Kreft [Sun, 18 Jan 2026 15:26:05 +0000 (10:26 -0500)] 
fix(typings): improve typing for server_default

Fixed typing issue where the :paramref:`.AlterColumnOp.server_default` and
:paramref:`.AlterColumnOp.existing_server_default` parameters failed to
accommodate common SQLAlchemy SQL constructs such as ``null()`` and
``text()``.   Pull request courtesy Sebastian Kreft.

this sets up a standard type for the server default argument using
an alias, and adds modifications to write_pyi for extremely basic
ability to render type aliases (with limitations).

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #1669
Closes: #1670
Pull-request: https://github.com/sqlalchemy/alembic/pull/1670
Pull-request-sha: e6464647b6e33e077e7baf4bbc5c7549ab570a06

Change-Id: Id25bf7fd706f91aa637adf9b67f0529f1d7d1080

2 weeks agoVersion 1.18.2 placeholder
Mike Bayer [Wed, 14 Jan 2026 18:53:32 +0000 (13:53 -0500)] 
Version 1.18.2 placeholder

2 weeks ago- 1.18.1 rel_1_18_1
Mike Bayer [Wed, 14 Jan 2026 18:52:26 +0000 (13:52 -0500)] 
- 1.18.1

2 weeks agoadd changelog for 7955bac60d39e4642
Mike Bayer [Wed, 14 Jan 2026 14:06:33 +0000 (09:06 -0500)] 
add changelog for 7955bac60d39e4642

Change-Id: Ib2722c7773aae2e05792cbce23130cc9f005856d

2 weeks agoremove isolate_from_table for dropconstraint
Mike Bayer [Tue, 13 Jan 2026 17:05:09 +0000 (12:05 -0500)] 
remove isolate_from_table for dropconstraint

Revised the change regarding SQLAlchemy 2.1 and deprecation warnings
related to ``isolate_from_table=True``. Further developments in release 2.1
have revised how this parameter will be modified.

Change-Id: I6af2a683660647980421b1ff761dcf53a61bb71a

2 weeks agofix typo in plugin logger name added in 1.18
Federico Caselli [Mon, 12 Jan 2026 21:25:18 +0000 (22:25 +0100)] 
fix typo in plugin logger name added in 1.18

Fixes: #1779
Change-Id: Ibebc4a91e4584ac6c999d7104bba5b3b7973f689

2 weeks agoVersion 1.18.1 placeholder
Mike Bayer [Fri, 9 Jan 2026 21:22:41 +0000 (16:22 -0500)] 
Version 1.18.1 placeholder

2 weeks ago- 1.18.0 rel_1_18_0
Mike Bayer [Fri, 9 Jan 2026 21:18:30 +0000 (16:18 -0500)] 
- 1.18.0

2 weeks agohappy new year
Mike Bayer [Fri, 9 Jan 2026 21:17:49 +0000 (16:17 -0500)] 
happy new year

Change-Id: Ic32750aabac7ad712a2a56081c0ebc452f425c62

2 weeks agoadd author
Mike Bayer [Fri, 9 Jan 2026 21:08:36 +0000 (16:08 -0500)] 
add author

Change-Id: I3bd8588a79494d6d79699361b30011b8bfe04e3d
(cherry picked from commit 0c559750ca5f2d012e1d31818b4af2512e4efc68)

3 weeks agonew pre-caching architecture for autogenerate
Mike Bayer [Mon, 22 Dec 2025 15:40:06 +0000 (10:40 -0500)] 
new pre-caching architecture for autogenerate

Autogenerate reflection sweeps now use the "bulk" inspector methods
introduced in SQLAlchemy 2.0, which for selected dialects including
PostgreSQL and Oracle use batched queries to reflect whole collections of
tables using O(1) queries rather than O(N).

This is the original proposed version that uses the Inspector
entirely with its public API, with the exception of reflect_table()
which makes a _ReflectionInfo on a per-table basis.  Other than
that, no private API assumptions are made.

If SQLAlchemy needed to add new fields to _ReflectionInfo, it just
needs to make sure they have default functions (which all the current fields
should have anyway, since there is even a ReflectionDefaults
constant that already provides these!)

This version is the one that does not imply any particular
changes in SQLAlchemy and does not have any sqla_compat logic,
so that we may have alembic using the new performance enhancements
allowing for SQLAlchemy to potentially improve its API for a later
release.

Other than that, typing of reflection functions is improved.

Fixes: #1771
Change-Id: I7b9a75fa81cefc377fdb1a22fc1cfc3da1765769

3 weeks agodont compare server defaults if user FN returns non-None
Mike Bayer [Mon, 5 Jan 2026 19:07:38 +0000 (14:07 -0500)] 
dont compare server defaults if user FN returns non-None

fixed regression caused by e532a7e39cb6b0e91fbe045778f3
where we started continuing default server default comparison
even if user defined function returned False.

Fixes: #1777
Change-Id: I99fe8a10bc58a83aae1f1fae48b3b151a4db64c6

4 weeks agofilter out ::regclass for sequences
Mike Bayer [Fri, 2 Jan 2026 19:19:46 +0000 (14:19 -0500)] 
filter out ::regclass for sequences

Fixed issue where PostgreSQL sequence defaults on non-primary key columns
were incorrectly detected as changed on every autogenerate run. Server
default comparison logic is adjusted to filter out the ``::regclass``
expression added by the server which interferes with the comparison.

Fixes: #1507
Change-Id: I3192b2a86b1982dfbc7c85b49d676e1434dafcf5

5 weeks agosupport paths in file_template
Mike Bayer [Fri, 26 Dec 2025 17:14:49 +0000 (12:14 -0500)] 
support paths in file_template

The ``file_template`` configuration option now supports directory paths,
allowing migration files to be organized into subdirectories. When using
directory separators in ``file_template`` (e.g.,
``%(year)d/%(month).2d/%(day).2d_%(rev)s_%(slug)s``), Alembic will
automatically create the necessary directory structure. The
``recursive_version_locations`` setting must be set to ``true`` when using
this feature in order for the revision files to be located for subsequent
commands.

Fixes: #1774
Change-Id: Id68a3b0483c6519d724bbb79bbf8b471ea697c36

5 weeks agoMerge "organize into a "plugin" directory structure" into main
Michael Bayer [Fri, 26 Dec 2025 17:03:24 +0000 (17:03 +0000)] 
Merge "organize into a "plugin" directory structure" into main

5 weeks agoorganize into a "plugin" directory structure
Mike Bayer [Thu, 11 Dec 2025 22:20:21 +0000 (17:20 -0500)] 
organize into a "plugin" directory structure

we attempt to move autogen functions into independent units
that are more obviously pluggable, and we add support for
arbitrary "plugin" entrypoints that could add more pluggable
units into autogenerate or anywhere else

Change-Id: Id606a76dc6d12a308028f6cfdad690e0e63a43e5

5 weeks agofix typos (#1769)
Fardin Alizadeh [Mon, 22 Dec 2025 19:47:52 +0000 (23:17 +0330)] 
fix typos (#1769)

6 weeks agoAvoid deprecation warning in add/drop constraint
Federico Caselli [Tue, 16 Dec 2025 20:30:47 +0000 (21:30 +0100)] 
Avoid deprecation warning in add/drop constraint

Ensure that alembic is compatible with the changes added in
https://github.com/sqlalchemy/sqlalchemy/issues/13006
by explicitly setting isolate_from_table=True in sqlalchemy 2.1

Change-Id: I0dd3b2aa2932ca11fbde113fe4d92306fb1f2bbb

6 weeks agoget write_pyi to support lowercase types with pipes
Mike Bayer [Tue, 16 Dec 2025 14:53:13 +0000 (09:53 -0500)] 
get write_pyi to support lowercase types with pipes

The specific form of `tuple[] | None` produces a `types.UnionType`
in some way that seems to not be what it has ever been previously
(an explicit Union will give you `<class 'typing._UnionGenericAlias'>`,
apparently).  so repr() this specific case so we can move to newer
typing formats.

As a test, this moves the type of partial_reordering to the newer
format.

Also, write output file using shutil.move from tempfile, so that
crashes of write_pyi dont corrupt the file.

Add version checks for black, python version

bump minimum python version to 3.12 as 3.11 seems to have problems
we dont need to fix

Change-Id: I91914c1e1b979ad84ca8b82d362ed94312645994

6 weeks agoFix typing of `partial_reordering`
Daniël [Tue, 16 Dec 2025 13:27:05 +0000 (08:27 -0500)] 
Fix typing of `partial_reordering`

<!-- Provide a general summary of your proposed changes in the Title field above -->
The typing of the `partial_reordering` argument of `batch_alter_table` is not correct.

<!-- Describe your changes in detail -->
As stated in the documentation and docstring, the `batch_alter_table()` function expects a list of tuples for the `partial_reordering` argument. The current typing suggests the user to insert a tuple containing Any into the argument, which doesn't align with the docstring.

<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ x] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #1764
Pull-request: https://github.com/sqlalchemy/alembic/pull/1764
Pull-request-sha: f0a0c1a913b93a2c71881e69be83a7888e21bc5e

Change-Id: I1f442df0674e85361234a97aed1d79f58d30214f

6 weeks agoforce the driver level on the bulk insert PG tests
Mike Bayer [Tue, 16 Dec 2025 03:01:06 +0000 (22:01 -0500)] 
force the driver level on the bulk insert PG tests

this changes to use the psycopg2 dialect in all cases
even if the default for postgresql changes.

this is to prepare for SQLAlchemy moving to psycopg as the
default dialect. I had hoped to move these tests to use psycopg
and test for bind casts, however, we are still running tests against
SQLAlchemy 1.4 which does not have the psycopg dialect.   so stick with
psycopg2 for now.

also adds an rmtree for build/ as apparently pip install is re-using
this directory if it's there from a previous build, and the
artfacts left over from the gerrit for "plugins" is interfering with
the stubs generation.   We really should find a way to make the stub
generation / testing more robust as it breaks much too easily and
without an easy way to tell why.

Change-Id: Ibdab43a2cda5ec4f697d35c8a5f090aa56492703

2 months agouse oracledb in test suite
Mike Bayer [Sun, 30 Nov 2025 16:32:25 +0000 (11:32 -0500)] 
use oracledb in test suite

CI uses oracledb by default now so make sure that's
installed.   update URLs etc. for 23c

Change-Id: Ic671bbaa90abb7387708f9fcc488fda2bc416b04

2 months agoMerge "Add logging for config load source in verbose mode" into main
Michael Bayer [Thu, 20 Nov 2025 22:26:04 +0000 (22:26 +0000)] 
Merge "Add logging for config load source in verbose mode" into main

2 months agoAdd logging for config load source in verbose mode
qu3vipon [Wed, 19 Nov 2025 20:47:39 +0000 (15:47 -0500)] 
Add logging for config load source in verbose mode

### Description
I added a log message to indicate where the Alembic configuration is being loaded from (file vs in-memory), which helps when verbose mode is enabled.

I also wrote tests for both branches. Each test passes when run individually, but they fail when running the entire test suite. It seems to be related to how Alembic’s logging hierarchy interacts with the global test environment, and I'm having difficulty diagnosing the issue with my current understanding of the logging system.

I'd appreciate any guidance or suggestions from maintainers on how the logging should be captured or how tests in this area are expected to be structured.

### Checklist
This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Fixes: #1737
Closes: #1754
Pull-request: https://github.com/sqlalchemy/alembic/pull/1754
Pull-request-sha: c9cacc717998301280d87d82c0cbfe9da1aee7c8

Change-Id: I9941f68b264bdc297c6afb2d5e8af34fe0d234fa

2 months agoimplement ColumnComment compiles for SQL Server
Mike Bayer [Thu, 20 Nov 2025 15:45:37 +0000 (10:45 -0500)] 
implement ColumnComment compiles for SQL Server

Implemented DDL for column comment add/update/delete when using the
:paramref:`.Operations.alter_column.comment` parameter with
:meth:`.Operations.alter_column` on Microsoft SQL Server.  Previously,
these functions were not implemented for SQL Server and would raise
``UnsupportedCompilationError``.

Fixes: #1755
Change-Id: Ia4a0f6cd44c4c4b691383b91ced5a9d898d79e46

2 months agoensure stub tests run on nox
Federico Caselli [Wed, 19 Nov 2025 22:18:26 +0000 (23:18 +0100)] 
ensure stub tests run on nox

Change-Id: I18fb652a475ed59ce92173da1bfa05be5de4b953

2 months agobump pytest to 9; add pyv to file template; use = for all custom args
Mike Bayer [Sat, 15 Nov 2025 16:46:35 +0000 (11:46 -0500)] 
bump pytest to 9; add pyv to file template; use = for all custom args

adding "test/" to pytest doesnt work because then we can't indicate
a specific set of test files.  use = for all sqlalchemy-custom
parameters instead to avoid [1]

[1] https://github.com/pytest-dev/pytest/issues/13913

Change-Id: I9eb5bbfac734fcb145fcf3ae58fcc55df6bb6e71

2 months agoVersion 1.17.3 placeholder
Mike Bayer [Fri, 14 Nov 2025 20:35:19 +0000 (15:35 -0500)] 
Version 1.17.3 placeholder

2 months ago- 1.17.2 rel_1_17_2
Mike Bayer [Fri, 14 Nov 2025 20:32:35 +0000 (15:32 -0500)] 
- 1.17.2

2 months agoAdd operation implementation replacement
justanothercatgirl [Wed, 12 Nov 2025 16:51:03 +0000 (11:51 -0500)] 
Add operation implementation replacement

Added :paramref:`.Operations.implementation_for.replace` parameter to
:meth:`.Operations.implementation_for`, allowing replacement of existing
operation implementations.  This allows for existing operations such as
:class:`.CreateTableOp` to be extended directly.  Pull request courtesy
justanothercatgirl.

Fixes: #1750
Closes: #1751
Pull-request: https://github.com/sqlalchemy/alembic/pull/1751
Pull-request-sha: 5eef47af3f8f14ff736f60a7dd7adc3bbfa47c62

Change-Id: I69526c3111d41640264f226f6655dc61f83595e5

2 months agorun drop default constraint ahead of type
Mike Bayer [Wed, 5 Nov 2025 14:19:57 +0000 (09:19 -0500)] 
run drop default constraint ahead of type

Fixed issue in SQL Server dialect where the DROP that's automatically
emitted for existing default constraints during an ALTER COLUMN needs to
take place before not just the modification of the column's default, but
also before the column's type is changed.

also vendor sqlalchemy's metadata fixture which otherwise does not
integrate with alembic's version of the connection fixture

Fixes: #1744
Change-Id: Ia756da024297354449f53e9f3254820dec542bef

2 months agoadjust sqlite test further
Mike Bayer [Tue, 4 Nov 2025 21:59:51 +0000 (16:59 -0500)] 
adjust sqlite test further

this test will fail on sqlalchemy prior to 2.0.25 which is not
yet released so make the req very specific

Change-Id: Ifa758949f773484cf03fec04e37042b42b8a607e

2 months agoadd test for issue 1743
Mike Bayer [Sat, 1 Nov 2025 02:35:49 +0000 (22:35 -0400)] 
add test for issue 1743

however this issue looks to be simple sqlite reflection issue
on sqlalchemy side

also fixes the incorrect exclusions code from 20c108720d7127ca.
just skip entire test if SQLite fk reflection is not there.
this exclusion should not have been added originally, it looks
like this was mistaken for a limitation when it really was a bug
in sqlite reflection

Change-Id: I3f51ebaf01f41dba86cea0aa31be28334401887b

2 months agoupdate the fk_names req
Mike Bayer [Sat, 1 Nov 2025 03:39:37 +0000 (23:39 -0400)] 
update the fk_names req

This is not a limitation this is just a bug in sqlalchemy,
being fixed by #12954.    we dont have a system in place
to cross-check gerrits right now so just merge this and then
merge the SQLAlchemy fix

Change-Id: I9c074c0edb9f55d2400e59a9b2b02603458e8f0b

3 months agoadd sqlalchemy version to output file name
Mike Bayer [Wed, 29 Oct 2025 16:53:52 +0000 (12:53 -0400)] 
add sqlalchemy version to output file name

Change-Id: I0194bd3619e867e147a115849c74ec996eee84df

3 months agoremove DB-based skips on non-backend tests
Mike Bayer [Wed, 29 Oct 2025 13:33:42 +0000 (09:33 -0400)] 
remove DB-based skips on non-backend tests

for tests that are testing for SQL compilation only,
there's no need to limit based on DB backend since we aren't
using it.  this avoids the awkward situation where tests like
test_sqlite.py -> test_create_table_with_comment_ignored would
be skipped when running the test suite against sqlite, but would
run just fine when running against any other DB (because those DBs
dont have a comment limitation and the test is just a compilation
test).

Change-Id: Iecd482e8c1034b28649ce5390dac0d0ddea83790

3 months agoensure relative files set for coverage
Mike Bayer [Wed, 29 Oct 2025 13:14:48 +0000 (09:14 -0400)] 
ensure relative files set for coverage

Change-Id: I834d540e35b317aaa679663c15f207c99fc9f749

3 months agoMerge "update toxnox with newer coverage/junit approach" into main
Michael Bayer [Wed, 29 Oct 2025 12:54:09 +0000 (12:54 +0000)] 
Merge "update toxnox with newer coverage/junit approach" into main

3 months agoupdate toxnox with newer coverage/junit approach
Mike Bayer [Wed, 29 Oct 2025 12:38:39 +0000 (08:38 -0400)] 
update toxnox with newer coverage/junit approach

Change-Id: Ieecafab1f929ed9afe0b0675acbeceaecc25e48e

3 months agoVersion 1.17.2 placeholder
Mike Bayer [Wed, 29 Oct 2025 00:23:35 +0000 (20:23 -0400)] 
Version 1.17.2 placeholder

3 months ago- 1.17.1 rel_1_17_1
Mike Bayer [Wed, 29 Oct 2025 00:21:39 +0000 (20:21 -0400)] 
- 1.17.1

3 months agoMerge "Add "--check-heads" option to "current" command" into main
Michael Bayer [Wed, 29 Oct 2025 00:20:54 +0000 (00:20 +0000)] 
Merge "Add "--check-heads" option to "current" command" into main

3 months agoAdd colon (:) to invalid char for revision name add unittest
Kim Wooseok [Tue, 28 Oct 2025 12:05:24 +0000 (08:05 -0400)] 
Add colon (:) to invalid char for revision name add unittest

Disallow ':' character in custom revision identifiers. Previously, using a
colon in a revision ID (e.g., 'REV:1') would create the revision, however
revisions with colons in them are not correctly interpreted by other
commands, as it overlaps with the revision range syntax.   Pull request
courtesy Kim Wooseok with original implementation by Hrushikesh Patil.

Fixes: #1540
Closes: #1741
Pull-request: https://github.com/sqlalchemy/alembic/pull/1741
Pull-request-sha: 3894b1f9a1b1685a01465f53886af9086e23d079

Change-Id: Ie935f0e04981a0b3d0ac8a2ac03ffebce898280a

3 months agoAdd "--check-heads" option to "current" command
Stefan Scherfke [Tue, 28 Oct 2025 12:06:31 +0000 (08:06 -0400)] 
Add "--check-heads" option to "current" command

Added :paramref:`.command.current.check_heads` parameter to
:func:`.command.current` command, available from the command line via the
``--check-heads`` option to ``alembic current``.  This tests if all head
revisions are applied to the database and raises :class:`.DatabaseNotAtHead`
(or from the command line, exits with a non-zero exit code) if this is not
the case.  The parameter operates equvialently to the cookbook recipe
:ref:`cookbook_check_heads`. Pull request courtesy Stefan Scherfke.

Fixes: #1705
Closes: #1739
Pull-request: https://github.com/sqlalchemy/alembic/pull/1739
Pull-request-sha: 955f9b7ff6216c3c2940597a652cce538a6e0f29

Change-Id: I1173217ff6a4927226ec9e7b8c7ef67c6431d728

3 months agoupdate for nox 2025-10-16
Mike Bayer [Sat, 18 Oct 2025 20:08:15 +0000 (16:08 -0400)] 
update for nox 2025-10-16

includes fix for  https://github.com/wntrblm/nox/pull/999

Change-Id: Id38dc01a1fb8a7446e427a8cf9a0cae2db6c4a3b

3 months agoVersion 1.17.1 placeholder
Mike Bayer [Sat, 11 Oct 2025 18:40:29 +0000 (14:40 -0400)] 
Version 1.17.1 placeholder

3 months ago- 1.17.0 rel_1_17_0
Mike Bayer [Sat, 11 Oct 2025 18:37:19 +0000 (14:37 -0400)] 
- 1.17.0

3 months agobump flake8/black tools
Mike Bayer [Sat, 11 Oct 2025 18:23:36 +0000 (14:23 -0400)] 
bump flake8/black tools

Change-Id: Idcd907ffe4dac6329abd1823ee0f450110801f8d

3 months agomore nox
Mike Bayer [Sat, 11 Oct 2025 17:30:07 +0000 (13:30 -0400)] 
more nox

* add support for backend-only
* main runner only runs one database at a time, there is no multiple
  db for one pytest run feature here
* use match/case!

Change-Id: I2f206593c33389d355e0e6eb0ac0dea38a5e4653

3 months agodrop py39 support
Mike Bayer [Sat, 11 Oct 2025 14:28:35 +0000 (10:28 -0400)] 
drop py39 support

Change-Id: I89a636ac3e687240ffb464acb8ade5055bba408b

3 months agoremove suite name changes
Mike Bayer [Thu, 9 Oct 2025 13:21:16 +0000 (09:21 -0400)] 
remove suite name changes

the junit plugin doesnt need suites to have distinct names.
it is actually merging correctly, the reason for lots of noise
is that the different suites have lots of skips for the
"backend" marked suites.   will fix this in pytestplugin

Change-Id: I4b73de0fbaca6840111d516565421e902c218f5d

3 months agodev
Mike Bayer [Tue, 7 Oct 2025 02:53:20 +0000 (22:53 -0400)] 
dev

Change-Id: I5651581e732ecd2a3c3f28e8593cb394b3fbd982

3 months agosurprise, session.run() failing ends the nox run
Mike Bayer [Mon, 6 Oct 2025 21:13:22 +0000 (17:13 -0400)] 
surprise, session.run() failing ends the nox run

Change-Id: I2c0b1570fb7e900ee943151b03e663c7d494edbd

3 months agoMerge "fix dropping of version tables in test" into main
Michael Bayer [Mon, 6 Oct 2025 21:00:27 +0000 (21:00 +0000)] 
Merge "fix dropping of version tables in test" into main

3 months agoMerge "Adapt test to support 2.1 change on pg compued" into main
Michael Bayer [Mon, 6 Oct 2025 20:37:24 +0000 (20:37 +0000)] 
Merge "Adapt test to support 2.1 change on pg compued" into main

3 months agofix dropping of version tables in test
Mike Bayer [Mon, 6 Oct 2025 20:34:35 +0000 (16:34 -0400)] 
fix dropping of version tables in test

Change-Id: I438fbe6ac41d0b4e5997fd1a7455cf4127aa1e19

3 months agoAdapt test to support 2.1 change on pg compued
Federico Caselli [Mon, 6 Oct 2025 20:20:12 +0000 (22:20 +0200)] 
Adapt test to support 2.1 change on pg compued

Fixes: #1734
Change-Id: Ia4222c7c963eb3c50f09ff911bc33a615b329eb7

3 months agomove junit logic to toxnox
Mike Bayer [Mon, 6 Oct 2025 20:19:14 +0000 (16:19 -0400)] 
move junit logic to toxnox

Change-Id: Ica686abc8f17cc46a663d7452b59e8c436e2971e

3 months agotest updates
Mike Bayer [Mon, 6 Oct 2025 20:01:03 +0000 (16:01 -0400)] 
test updates

* remove .coveragerc since this produces warnings vs. pytest-cov
* use junitparser to rename the suite inside each junit file.  I think
  jenkins junit reads multiple files but they need to have distinct
  suite names to show up (or distinct test names, but we dont have that
  here).

Change-Id: Ic785969e7b41408eeb50028339c27c7e459cd8e0

3 months agoworking out nox edge cases
Mike Bayer [Fri, 3 Oct 2025 19:12:12 +0000 (15:12 -0400)] 
working out nox edge cases

Change-Id: Ibba2450cb0bc18de77fcee9e58fda083ce8a7332

3 months agouse nox
Mike Bayer [Fri, 26 Sep 2025 21:32:45 +0000 (17:32 -0400)] 
use nox

this includes an adapted form of tox generative environments
ported to nox.

Change-Id: Ifada3485adb50ab6ed5a80f78986eb657abc5f08

4 months agofix mypy failure
Mike Bayer [Sat, 27 Sep 2025 15:39:20 +0000 (11:39 -0400)] 
fix mypy failure

Change-Id: I33769e9ef98a0f35d7429cd63c857b98298161be

4 months agoFix typo in Alembic configuration file description 1724/head
Rémy DUTHU [Sun, 7 Sep 2025 09:21:33 +0000 (11:21 +0200)] 
Fix typo in Alembic configuration file description

5 months agoMerge "adapt alembic for the inherit_schema change sqlalchemy 2.1" into main
Federico Caselli [Thu, 28 Aug 2025 16:27:13 +0000 (16:27 +0000)] 
Merge "adapt alembic for the inherit_schema change sqlalchemy 2.1" into main

5 months agoexclude 3.9 for main
Mike Bayer [Wed, 27 Aug 2025 18:15:04 +0000 (14:15 -0400)] 
exclude 3.9 for main

Change-Id: I50d34f31d7a4f03f890287180faf8af4b72b9c7f

5 months agoVersion 1.16.6 placeholder
Mike Bayer [Wed, 27 Aug 2025 18:02:20 +0000 (14:02 -0400)] 
Version 1.16.6 placeholder

5 months ago- 1.16.5 rel_1_16_5
Mike Bayer [Wed, 27 Aug 2025 18:00:31 +0000 (14:00 -0400)] 
- 1.16.5

5 months agofix(config): Accept int on toml config
Luís Henrique Allebrandt Schunemann [Tue, 19 Aug 2025 12:59:24 +0000 (08:59 -0400)] 
fix(config): Accept int on toml config

Fixed issue where new pyproject.toml config would fail to parse the integer
value used for the ``truncate_slug_length`` parameter.  Pull request
courtesy Luís Henrique Allebrandt Schunemann.

Fixes: #1709
Closes: #1710
Pull-request: https://github.com/sqlalchemy/alembic/pull/1710
Pull-request-sha: 87652ee288d2e0a4883394cd244f23b3e13c323e

Change-Id: Ide0f00437740c94250815a5340b2d742e960d1ca

5 months agoadapt alembic for the inherit_schema change sqlalchemy 2.1
Federico Caselli [Mon, 25 Aug 2025 20:59:43 +0000 (22:59 +0200)] 
adapt alembic for the inherit_schema change sqlalchemy 2.1

This adapts alembic to ignore the inherit_schema argument

Change-Id: Ib0f10521fe4e22855612b0cac0d44e2edaec7b3e

5 months agoadd httphost key
Mike Bayer [Sat, 16 Aug 2025 13:58:35 +0000 (09:58 -0400)] 
add httphost key

Change-Id: I64742bba7398b1820e6e944cc998e34674e6f1fa

5 months agouse ssh host
Mike Bayer [Sat, 16 Aug 2025 13:49:31 +0000 (09:49 -0400)] 
use ssh host

Change-Id: I4cfbe784a406833917e67a2a53607db1999fe99b

6 months agoFixed rendering of index expressions in MySQL
david-fed [Tue, 15 Jul 2025 12:38:28 +0000 (08:38 -0400)] 
Fixed rendering of index expressions in MySQL

Fixed Python-side autogenerate rendering of index expressions in MySQL
dialect by aligning it with SQLAlchemy's MySQL index expression rules. Pull
request courtesy david-fed.

Fixes: #1492
Closes: #1695
Pull-request: https://github.com/sqlalchemy/alembic/pull/1695
Pull-request-sha: 8f9ed8f3189d2d99d9bea03cbaaabb937af40bba

Change-Id: I3b838b4b7a44e3d5a279ba30624c1552f99959d7

6 months agoVersion 1.16.5 placeholder
Mike Bayer [Thu, 10 Jul 2025 16:17:37 +0000 (12:17 -0400)] 
Version 1.16.5 placeholder

6 months ago- 1.16.4 rel_1_16_4
Mike Bayer [Thu, 10 Jul 2025 16:16:12 +0000 (12:16 -0400)] 
- 1.16.4

6 months agoadd boolean interpretation to config
Mike Bayer [Wed, 9 Jul 2025 18:57:11 +0000 (14:57 -0400)] 
add boolean interpretation to config

Fixed issue in new ``pyproject.toml`` support where boolean values, such as
those used for the ``recursive_version_locations`` and ``sourceless``
configuration parameters, would not be accepted.

Fixes: #1694
Change-Id: Ifeed46c599ab20db1713f306b7be9c3b5fe23485

6 months agoVersion 1.16.4 placeholder
Mike Bayer [Tue, 8 Jul 2025 18:58:04 +0000 (14:58 -0400)] 
Version 1.16.4 placeholder

6 months ago- 1.16.3 rel_1_16_3
Mike Bayer [Tue, 8 Jul 2025 18:56:28 +0000 (14:56 -0400)] 
- 1.16.3

6 months agoedits
Mike Bayer [Tue, 8 Jul 2025 18:56:11 +0000 (14:56 -0400)] 
edits

Change-Id: Id490125a9ff4e23ba45b48ae89a55044a20f27f5

6 months agoMerge "Fixed missing prefix on FetchedValue" into main
Michael Bayer [Tue, 8 Jul 2025 18:44:16 +0000 (18:44 +0000)] 
Merge "Fixed missing prefix on FetchedValue" into main

6 months agoAdd "module" post-write hook
Frazer McLean [Tue, 8 Jul 2025 15:01:43 +0000 (11:01 -0400)] 
Add "module" post-write hook

This hook type is almost identical to the console_scripts hook, except
it's running `python -m black` instead of using black's console_script.

It is mainly useful for tools without console scripts (e.g. ruff), but
has semantics closer to the console_scripts hook in that it finds the
ruff module available to the running interpreter instead of finding
an executable by path.

Pull request courtesy Frazer McLean.

Fixes: #1686
Closes: #1687
Pull-request: https://github.com/sqlalchemy/alembic/pull/1687
Pull-request-sha: 54d29c34642d88e88ab29e46fa4022d227f8aa60
Change-Id: I804a1a7d3f6423ba23bc556b7f4024c401a8787e

6 months agoFixed missing prefix on FetchedValue
david-fed [Mon, 7 Jul 2025 20:44:15 +0000 (16:44 -0400)] 
Fixed missing prefix on FetchedValue

Fixed the rendering of ``server_default=FetchedValue()`` to ensure it is
preceded by the ``sa.`` prefix in the migration script. Pull request
courtesy david-fed.

Fixes: #1633
Closes: #1691
Pull-request: https://github.com/sqlalchemy/alembic/pull/1691
Pull-request-sha: 468ad598c7975d240c3b9911585b3367f32900af
Change-Id: I828655e26c5e6d2a39d5407dbcc20bda19d11a7a

6 months agofix metadata requirement in fk render; remove column.copy()
Mike Bayer [Tue, 8 Jul 2025 14:05:56 +0000 (10:05 -0400)] 
fix metadata requirement in fk render; remove column.copy()

Fixed autogenerate rendering bug which failed to render foreign key
constraints local to a :class:`.CreateTableOp` object if it did not refer
to a ``MetaData`` collection via a private constructor argument that would
not ordinarily be passed in user-defined rewriter recipes, including ones
in the Alembic cookbook section of the docs.

Also removed the use of column.copy() from the CreateTableOp rewriter
recipe and added a new test for this recipe which includes a table with
an FK.  it's not clear why copy() was needed here and if we get more
reports of issues, we can add to this test suite and adjust.

Fixes: #1692
Change-Id: I6cf6c8f62b7eb116cfc78216b3dbcbddad499691

7 months agoAdd pyproject async template to Alembic
Alc-Alc [Fri, 20 Jun 2025 12:56:37 +0000 (08:56 -0400)] 
Add pyproject async template to Alembic

Added new ``pyproject_async`` template, combining the new ``pyproject``
template with the ``async`` template.  Pull request courtesy Alc-Alc.

Closes: #1683
Pull-request: https://github.com/sqlalchemy/alembic/pull/1683
Pull-request-sha: 46d03fbff27f9569545854ba9e6ad388892adcfd

Change-Id: I4071e069154541bdb1af864982e553bee687222e

7 months agotry flake8-import-order 0.19.2
Mike Bayer [Tue, 24 Jun 2025 18:04:56 +0000 (14:04 -0400)] 
try flake8-import-order 0.19.2

the big new thang is that it is doing import order checks inside of
TYPE_CHECKING blocks.   Introduces some new codes that we
enthusiastically add to our ignore list.

Change-Id: I4e844408a8b218f9b92c43ad5e2a5c16781100be

7 months agodemo mysql alter for collate/charset
Mike Bayer [Thu, 19 Jun 2025 01:47:18 +0000 (21:47 -0400)] 
demo mysql alter for collate/charset

Change-Id: I80cf0ccea6023c1e3411eaf6eeec7b2e5acb73e5

7 months agoVersion 1.16.3 placeholder
Mike Bayer [Mon, 16 Jun 2025 18:05:24 +0000 (14:05 -0400)] 
Version 1.16.3 placeholder

7 months ago- 1.16.2 rel_1_16_2
Mike Bayer [Mon, 16 Jun 2025 18:03:04 +0000 (14:03 -0400)] 
- 1.16.2

7 months agochangelog edits
Mike Bayer [Mon, 16 Jun 2025 18:02:26 +0000 (14:02 -0400)] 
changelog edits

Change-Id: I5bd111c1a2110bb6c386d40295836aae87922c32

7 months agosupport 'append_delimiter' to fix #1679
jonathan vanasco [Mon, 16 Jun 2025 15:36:20 +0000 (11:36 -0400)] 
support 'append_delimiter' to fix #1679

Fixed rendering of ``pyproject.toml`` to include two newlines when
appending content to an existing file.  Pull request courtesy Jonathan
Vanasco.

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #1679
Closes: #1680
Pull-request: https://github.com/sqlalchemy/alembic/pull/1680
Pull-request-sha: 20b2aca0d2f6a8f5957063b950e45874343e9a99

Change-Id: Ic2e76a3f791dbda0bd61f09a2c7bafbcdab5eb7f

7 months agoblock flake8-import-order 0.19.0
Mike Bayer [Mon, 16 Jun 2025 16:43:01 +0000 (12:43 -0400)] 
block flake8-import-order 0.19.0

It looks like their attempt to fix [1] has backfired in [2]

[1] https://github.com/PyCQA/flake8-import-order/issues/201
[2] https://github.com/PyCQA/flake8-import-order/issues/212

Change-Id: I755450a0b17215fe1e04a12e4d966d672b637b76

7 months agoMerge "[Fixes #1671] Passthrough `dialect_kwargs` to `ops.create_foreign_key()`"...
Michael Bayer [Mon, 16 Jun 2025 16:19:50 +0000 (16:19 +0000)] 
Merge "[Fixes #1671] Passthrough `dialect_kwargs` to `ops.create_foreign_key()`" into main

7 months agofix: remove double quotation marks in logs (#1682)
Tom Stein [Thu, 12 Jun 2025 20:07:07 +0000 (22:07 +0200)] 
fix: remove double quotation marks in logs (#1682)

- the '%r' caused two single ticks like '' to show
- What we want is a single tick '
- This aligns now with the usage in other log statements

7 months ago[Fixes #1671] Passthrough `dialect_kwargs` to `ops.create_foreign_key()`
Justin Malin [Thu, 12 Jun 2025 19:56:36 +0000 (15:56 -0400)] 
[Fixes #1671] Passthrough `dialect_kwargs` to `ops.create_foreign_key()`

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->
Fixes #1671

SqlAlchemy supports adding dialect kwargs for foreign keys, as does `op.create_foreign_key()`, but the renderer for `ops.CreateForeignKeyOp` does not pass through `dialect_kwargs`. An example of this is `postgresql_not_valid`.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #1672
Pull-request: https://github.com/sqlalchemy/alembic/pull/1672
Pull-request-sha: 246a363617b1a4a5885d2fed32e82f3312b386ef

Change-Id: I5dabbc4dc408c13883a6225733d7c38f8daeee38

7 months agoupdates for mypy 1.16
Mike Bayer [Sun, 8 Jun 2025 20:14:19 +0000 (16:14 -0400)] 
updates for mypy 1.16

some errors go away, others come in.   basically moving
ignores around.  need to pin to 1.16 at the lowest as these
would now fail on earlier mypy versions

Change-Id: Ia46084c69f1496ad77e215aab3fe1e6104361a96

7 months agodocument toml_file argument
Mike Bayer [Sun, 8 Jun 2025 19:29:16 +0000 (15:29 -0400)] 
document toml_file argument

Change-Id: I3edf7f32d818ffa4f6cf08d15a2d1e4f20137ff2

8 months agoallow tuple type in down_revision in migration templates
Simon Tas [Thu, 29 May 2025 00:11:58 +0000 (20:11 -0400)] 
allow tuple type in down_revision in migration templates

<!-- Provide a general summary of your proposed changes in the Title field above -->

FIXES #1665

Currently the type of `down_revision` in migration templates is `Union[str, None]`. However, when you generate a migration using `alembic merge heads` it will generate a migration with a tuple of strings in `down_revision` which causes a type error.

### Description

f.e. when you have 2 heads and run `alembic merge heads` you will get a migration that looks like this:

```py
revision: str = "6cee9e23ed4b"
down_revision: Union[str, None] = ("aba1172f1a9f", "cdd5e67db84f")
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
```

which will give a type error with type checkers like mypy and pyright. This change fixes this. From the code it seems like just like `branch_labels` and `depends_on` the `down_revision` is first casted to a tuple if needed so typing it as `Sequence[str]` and not `Tuple[str, ...]` should be safe.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

**Have a nice day!**

Closes: #1666
Pull-request: https://github.com/sqlalchemy/alembic/pull/1666
Pull-request-sha: 186df96240a621ba71247a4f5cbd6413e3bfc270

Change-Id: I7b203b85bf69f215871995e4c4f5b96c20528c7d

8 months agofix typo in tutoral.rst
Federico Caselli [Fri, 23 May 2025 18:24:14 +0000 (20:24 +0200)] 
fix typo in tutoral.rst

Change-Id: I59be2e4c8d977d4e4c0138d57d01615781c153eb

8 months agoadd detailed information on escaping percent signs in config files
Mike Bayer [Fri, 23 May 2025 15:54:12 +0000 (11:54 -0400)] 
add detailed information on escaping percent signs in config files

References: https://github.com/sqlalchemy/alembic/discussions/1662
Change-Id: I8ab42a8154976adda1a21d7eda008605a482fda2

8 months agoVersion 1.16.2 placeholder
Mike Bayer [Wed, 21 May 2025 23:11:23 +0000 (19:11 -0400)] 
Version 1.16.2 placeholder

8 months ago- 1.16.1 rel_1_16_1
Mike Bayer [Wed, 21 May 2025 23:10:03 +0000 (19:10 -0400)] 
- 1.16.1