]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
2 years agoChangelog: add 1.10.5 (unreleased) entry note about docstring code formatting 1228/head
James Addison [Wed, 26 Apr 2023 10:25:01 +0000 (11:25 +0100)] 
Changelog: add 1.10.5 (unreleased) entry note about docstring code formatting

2 years agoFixup: consistency: re-apply black code formatting to Operation.create_primary_key...
James Addison [Wed, 26 Apr 2023 10:20:53 +0000 (11:20 +0100)] 
Fixup: consistency: re-apply black code formatting to Operation.create_primary_key snippet, allowing it to fit on a single line

Follows-on-from commit 84462eee9b742e58e0f1937f17820e946508b4e3.

2 years agoFixup: consistency: also apply codestyle formatting to 'server_default' snippet in...
James Addison [Wed, 26 Apr 2023 10:18:04 +0000 (11:18 +0100)] 
Fixup: consistency: also apply codestyle formatting to 'server_default' snippet in Operation.create_table docstring

Follows-on-from commit 84462eee9b742e58e0f1937f17820e946508b4e3.

2 years agoConsistency: apply codestyle formatting to docstring code snippets
James Addison [Thu, 13 Apr 2023 19:11:01 +0000 (15:11 -0400)] 
Consistency: apply codestyle formatting to docstring code snippets

### Description
This is a pedantic/consistency follow-up from #1219: that change applied some `black` formatting to two code snippets, and this change applies that formatting to the remaining snippets in the codebase.

For each snippet, I extracted the code and applied formatting using `black` v23.1.0, then placed the results back into the source.

In one case there was an associated 'output' block, and in that case I re-ran the snippet code to update the results of that output too (this included a [change-in-output](https://github.com/sqlalchemy/alembic/compare/main...openculinary:alembic:docstrings/snippet-format-consistency?expand=1#diff-bf4756660cdb31ee8566a2cff72526671356c38a725195723ce0e65e6c11e6cfR124) thanks to a [bugfix since the snippet was written](https://github.com/sqlalchemy/alembic/commit/bc6971aa4abdafb7e1a1123c26a373cc25a34ca9), by the looks of it).

### Checklist

This pull request is:

- [x] A documentation / typographical error fix

Closes: #1220
Pull-request: https://github.com/sqlalchemy/alembic/pull/1220
Pull-request-sha: cd65a453192546a660d6f5ebad5af08bb1c72af4

Change-Id: I6758445633c364c8fb2f4d8376d83607430a36d6

2 years agoMerge "Improve typing." into main
mike bayer [Tue, 25 Apr 2023 16:42:38 +0000 (16:42 +0000)] 
Merge "Improve typing." into main

2 years agorename upload-dir to upload_dir to silence setuptool warning
Federico Caselli [Mon, 24 Apr 2023 20:09:18 +0000 (22:09 +0200)] 
rename upload-dir to upload_dir to silence setuptool warning

Change-Id: I048cc0653de1b7885665b747cceb083d348f7f18

2 years agoadd missing tag to 1.10.4 changelog
Federico Caselli [Mon, 24 Apr 2023 19:33:13 +0000 (21:33 +0200)] 
add missing tag to 1.10.4 changelog

Change-Id: Ifbec22c07ce887f4e25d25ad47aff44dcbae366b

2 years agoVersion 1.10.5 placeholder
Mike Bayer [Mon, 24 Apr 2023 15:12:43 +0000 (11:12 -0400)] 
Version 1.10.5 placeholder

2 years ago- 1.10.4 rel_1_10_4
Mike Bayer [Mon, 24 Apr 2023 15:08:10 +0000 (11:08 -0400)] 
- 1.10.4

2 years agoImprove typing.
Federico Caselli [Thu, 13 Apr 2023 20:22:14 +0000 (22:22 +0200)] 
Improve typing.

Correctly pass previously ignored arguments ``insert_before`` and
``insert_after`` in ``batch_alter_column``

Fixes: #1221
Change-Id: I79c9144f3e521fca00a0c32462ae2a69f9f7a032

2 years agoFix type annotation in `op.create_table_comment`
Colin Adams [Thu, 13 Apr 2023 19:24:41 +0000 (15:24 -0400)] 
Fix type annotation in `op.create_table_comment`

### Description

The `existing_comment` parameter had type `None`, but it should be `Optional[str]`.

Fixes #903

### Checklist

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: #1115
Pull-request: https://github.com/sqlalchemy/alembic/pull/1115
Pull-request-sha: 973ca93b199dccf4474db650bcfee797b2bf7c51

Change-Id: Ic4a25e320fe3e4578e3df9aea689d760844c055e

2 years agotooling: write_pyi.py: filter usage of raw-strings (rstrings)
James Addison [Mon, 10 Apr 2023 19:40:38 +0000 (15:40 -0400)] 
tooling: write_pyi.py: filter usage of raw-strings (rstrings)

### Description
While reading the diff between [`rel_1_10_2...rel_1_10_3`](https://github.com/sqlalchemy/alembic/compare/rel_1_10_2...rel_1_10_3), the introduction of r-strings drew my attention, and that resulted in some [discussion on the relevant commit](https://github.com/sqlalchemy/alembic/commit/bc0c305b7c2cc0401e250fcd6a725aacecdd6e33).

This changeset filters the production of r-strings during stub-generation to cases where docstrings contain escape (backslash, `\`) characters.

I'll admit that I didn't realize until today that these stubs are primarily for typechecking.  Since that's the case, I have doubts about whether the change is worthwhile (consistency and simplicity -- using r-strings for all docstrings in the stubs -- even if it's redundant, seems fine to me).

### Checklist
This pull request is:

- [x] A documentation / typographical error fix
- [x] A short code fix
- Relates to discussion at https://github.com/sqlalchemy/alembic/commit/bc0c305b7c2cc0401e250fcd6a725aacecdd6e33

Closes: #1218
Pull-request: https://github.com/sqlalchemy/alembic/pull/1218
Pull-request-sha: 352ab8829525435f78838687e12156a3fa3a3d86

Closes: #1219
Pull-request: https://github.com/sqlalchemy/alembic/pull/1219
Change-Id: I2808a592681dabc093d538f589e673fcc5e05822

2 years agoMerge "Use column sort in index compare on postgresql" into main
mike bayer [Mon, 10 Apr 2023 21:01:11 +0000 (21:01 +0000)] 
Merge "Use column sort in index compare on postgresql" into main

2 years agoUse column sort in index compare on postgresql
CaselIT [Thu, 6 Apr 2023 20:16:41 +0000 (22:16 +0200)] 
Use column sort in index compare on postgresql

Added support for autogenerate comparison of indexes on PostgreSQL which
include SQL sort option, such as ``ASC`` or ``NULLS FIRST``.

Fixes: #1213
Change-Id: I3ddcb647928d948e41462b1c889b1cbb515ace4f

2 years agouniquify cols for FK table object
Mike Bayer [Fri, 7 Apr 2023 15:05:20 +0000 (11:05 -0400)] 
uniquify cols for FK table object

Fixed issue where using a directive such as ``op.create_foreign_key()`` to
create a self-referential constraint on a single table where the same
column were present on both sides (e.g. within a composite foreign key)
would produce an error under SQLAlchemy 2.0 and a warning under SQLAlchemy
1.4 indicating that a duplicate column were being added to a table.

Change-Id: I2a8f5d8def2714792bffcdfb8bf88a5080ec8ce7
Fixes: #1215
2 years agoVersion 1.10.4 placeholder
Mike Bayer [Wed, 5 Apr 2023 19:40:58 +0000 (15:40 -0400)] 
Version 1.10.4 placeholder

2 years ago- 1.10.3 rel_1_10_3
Mike Bayer [Wed, 5 Apr 2023 19:39:34 +0000 (15:39 -0400)] 
- 1.10.3

2 years agoMerge "Fix issues in autogenerate of function index removal" into main
mike bayer [Tue, 4 Apr 2023 14:51:51 +0000 (14:51 +0000)] 
Merge "Fix issues in autogenerate of function index removal" into main

2 years agoMerge "Fix type annotation for `url`" into main
mike bayer [Mon, 3 Apr 2023 23:00:40 +0000 (23:00 +0000)] 
Merge "Fix type annotation for `url`" into main

2 years agoFix issues in autogenerate of function index removal
CaselIT [Mon, 3 Apr 2023 21:15:45 +0000 (23:15 +0200)] 
Fix issues in autogenerate of function index removal

Fixed error raised by alembic when running autogenerate after removing
a function based index.

Fixes: #1212
Change-Id: Idc565d661229afda89d44e36786bb0357323e604

2 years agoFix type annotation for `url`
Viicos [Sun, 26 Mar 2023 02:02:22 +0000 (22:02 -0400)] 
Fix type annotation for `url`

<!-- Provide a general summary of your proposed changes in the Title field above -->
Left the `pyi` generated file untouched.
### Description
<!-- Describe your changes in detail -->

### 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:

- [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: #1209
Pull-request: https://github.com/sqlalchemy/alembic/pull/1209
Pull-request-sha: d15cb6e28d5bb934d139ced87e713a9d77505346

Change-Id: I8548806a693b150f1417a102e6498119524008a0

2 years agoAdd docs for data migrations
Vlastimil Zíma [Sat, 4 Jun 2022 14:28:36 +0000 (10:28 -0400)] 
Add docs for data migrations

### Description
I added a small docs regarding data migrations, based on #972.

### 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:

- [X] A documentation / typographical error fix
- Good to go, no issue or tests are needed

**Have a nice day!**

Closes: #1040
Pull-request: https://github.com/sqlalchemy/alembic/pull/1040
Pull-request-sha: c985e0d8096e750df35aa07dde71f432a57656b6

Change-Id: Icf6fdb1089eb7c386dad4401b99caaddc352d92f

2 years agoFix unknown types reported by pyright
CaselIT [Mon, 6 Mar 2023 21:15:15 +0000 (22:15 +0100)] 
Fix unknown types reported by pyright

Fixed various typing issues observed with pyright, including issues
involving the combination of :class:`.Function` and
:meth:`.MigrationContext.begin_transaction`.

Fixes: #1191
Fixes: #1201
Change-Id: I9856a8f59c22130c8bbcbed3e19cf2e8a8bf0608

2 years agoVersion 1.10.3 placeholder
Mike Bayer [Wed, 8 Mar 2023 17:18:10 +0000 (12:18 -0500)] 
Version 1.10.3 placeholder

2 years ago- 1.10.2 rel_1_10_2
Mike Bayer [Wed, 8 Mar 2023 17:16:40 +0000 (12:16 -0500)] 
- 1.10.2

2 years agomock _NONE_NAME for < 1.3.24
Mike Bayer [Tue, 7 Mar 2023 16:07:33 +0000 (11:07 -0500)] 
mock _NONE_NAME for < 1.3.24

Fixed regression where Alembic would not run with older SQLAlchemy 1.3
versions prior to 1.3.24 due to a missing symbol. Workarounds have been
applied for older 1.3 versions.

Change-Id: Ie7b5f6295e55276f0e912bf2b10b8c96dad171b9
Fixes: #1196
2 years agoVersion 1.10.2 placeholder
Mike Bayer [Tue, 7 Mar 2023 01:14:59 +0000 (20:14 -0500)] 
Version 1.10.2 placeholder

2 years ago- 1.10.1 rel_1_10_1
Mike Bayer [Tue, 7 Mar 2023 01:12:57 +0000 (20:12 -0500)] 
- 1.10.1

2 years agoMerge "improve autogen rendering for PG ExcludeConstraint" into main
mike bayer [Tue, 7 Mar 2023 01:11:33 +0000 (01:11 +0000)] 
Merge "improve autogen rendering for PG ExcludeConstraint" into main

2 years agoimprove autogen rendering for PG ExcludeConstraint
Jan Katins [Mon, 6 Mar 2023 21:18:17 +0000 (16:18 -0500)] 
improve autogen rendering for PG ExcludeConstraint

Fixed issue regarding PostgreSQL :class:`.ExcludeConstraint`, where
constraint elements which made use of :func:`.literal_column` could not be
rendered for autogenerate. Additionally, using SQLAlchemy 2.0.5 or greater,
:func:`.text()` constructs are also supported within PostgreSQL
:class:`.ExcludeConstraint` objects for autogenerate render. Pull request
courtesy Jan Katins.

Fixes: #1184
Closes: #1185
Pull-request: https://github.com/sqlalchemy/alembic/pull/1185
Pull-request-sha: 68360ce9aa746a85407c5e1e04b8021123d98504

Change-Id: I302f3f4007a186ffac13b344ff6769dd302f28f5

2 years agodistinguish between string contraint name and defined
Mike Bayer [Mon, 6 Mar 2023 18:34:40 +0000 (13:34 -0500)] 
distinguish between string contraint name and defined

Take _NONE_NAME into account as a valid constraint name
and don't skip these constraints or consider them to be unnamed.
Thanks to typing this also revealed that previous batch versions
were also keying "_NONE_NAME" constraints as though they were named.

Fixed regression for 1.10.0 where :class:`.Constraint` objects were
suddenly required to have non-None name fields when using batch mode, which
was not previously a requirement.

Change-Id: If4a7191a00848b19cb124bc6da362f3bc6ce1472
Fixes: #1195
2 years agoVersion 1.10.1 placeholder
Mike Bayer [Sun, 5 Mar 2023 23:12:18 +0000 (18:12 -0500)] 
Version 1.10.1 placeholder

2 years ago- 1.10.0 rel_1_10_0
Mike Bayer [Sun, 5 Mar 2023 23:06:04 +0000 (18:06 -0500)] 
- 1.10.0

2 years agochangelog updates
Mike Bayer [Sun, 5 Mar 2023 23:05:24 +0000 (18:05 -0500)] 
changelog updates

Change-Id: I2c796e4120a4674a46f4ebedbf63d9e40ebe49b9

2 years agoUpdate example to sqlalchemy 2 (#1171)
Sam Bull [Wed, 1 Mar 2023 21:54:49 +0000 (21:54 +0000)] 
Update example to sqlalchemy 2 (#1171)

2 years agoFixes test in older sqlite
CaselIT [Wed, 1 Mar 2023 21:49:33 +0000 (22:49 +0100)] 
Fixes test in older sqlite

Change-Id: I2f816a37abf7fa3203879e1d03b55307bd957ee4

2 years agoMerge "Improved support for expression indexes" into main
mike bayer [Wed, 1 Mar 2023 21:28:01 +0000 (21:28 +0000)] 
Merge "Improved support for expression indexes" into main

2 years agoMerge "Improve typing to accommodate sqlalchemy v2" into main
mike bayer [Wed, 1 Mar 2023 21:27:09 +0000 (21:27 +0000)] 
Merge "Improve typing to accommodate sqlalchemy v2" into main

2 years agoMerge "add recursive_version_locations option for searching revision files" into...
mike bayer [Wed, 1 Mar 2023 21:26:15 +0000 (21:26 +0000)] 
Merge "add recursive_version_locations option for searching revision files" into main

2 years agoMerge "set next version at 1.10.0" into main
mike bayer [Wed, 1 Mar 2023 21:26:06 +0000 (21:26 +0000)] 
Merge "set next version at 1.10.0" into main

2 years agoadd recursive_version_locations option for searching revision files
ostr00000 [Mon, 27 Feb 2023 23:18:19 +0000 (18:18 -0500)] 
add recursive_version_locations option for searching revision files

Recursive traversal of revision files in a particular revision directory is
now supported, by indicating ``recursive_version_locations = true`` in
alembic.ini. Pull request courtesy ostr00000.

Fixes: #760
Closes: #1182
Pull-request: https://github.com/sqlalchemy/alembic/pull/1182
Pull-request-sha: ecb0da48b459abd3f5e95390ec7030a7e3fcbc6d

Change-Id: I711ca2dbd35fb9a2acdbfd374bcac13043b0d129

2 years agoEscape sql server constriant names
CaselIT [Thu, 23 Feb 2023 20:45:11 +0000 (21:45 +0100)] 
Escape sql server constriant names

Properly escape constraint name on SQL Server when dropping
a column while specifying ``mssql_drop_default=True`` or
``mssql_drop_check=True`` or ``mssql_drop_foreign_key=True``.

Fixes: #1187
Change-Id: I060442bc63c4e53f64724985e20e6e15e4335b6b

2 years agoensure single import per line
Mike Bayer [Tue, 28 Feb 2023 15:58:22 +0000 (10:58 -0500)] 
ensure single import per line

This adds the very small plugin flake8-import-single which
will prevent us from having an import with more than one symbol
on a line.

Flake8 by itself prevents this pattern with E401:

   import collections, os, sys

However does not do anything with this:

   from sqlalchemy import Column, text

Both statements have the same issues generating merge artifacts
as well as presenting a manual decision to be made.   While
zimports generally cleans up such imports at the top level, we
don't enforce zimports / pre-commit use.

the plugin finds the same issue for imports that are inside of
test methods.   We shouldn't usually have imports in test methods
so most of them here are moved to be top level.

The version is pinned at 0.1.5; the project seems to have no
activity since 2019, however there are three 0.1.6dev releases
on pypi which stopped in September 2019, they seem to be
experiments with packaging.  The source for 0.1.5
is extremely simple and only reveals one method to flake8
(the run() method).

Change-Id: Icea894e43bad9c0b5d4feb5f49c6c666d6ea6aa1

2 years agoImproved support for expression indexes
CaselIT [Sat, 4 Feb 2023 12:28:42 +0000 (13:28 +0100)] 
Improved support for expression indexes

Added support for autogenerate comparison of indexes on PostgreSQL which
include SQL expressions; the previous warning that such indexes were
skipped is now removed. This functionality requires SQLAlchemy 2.0.
For older SQLAlchemy versions, these indexes are still skipped.

Fixed issue where indexes on SQLite which include SQL expressions would not
compare against themselves correctly, generating false positives.
SQLAlchemy as of version 2 has no support for reflecting expression based
indexes on SQLite; so for now, the behavior is that SQLite expression-based
indexes are ignored for autogenerate compare, in the same way that
PostgreSQL expression-based indexes were ignored for the time that
SQLAlchemy did not support reflection of such indexes (which is now
supported in SQLAlchemy 2.0 as well as this release of Alembic).

Fixed issue in index detection where autogenerate change detection would
consider indexes with the same columns but with different order as equal,
while in general they are not equivalent in how a database will use them.

Fixes: #1165
Fixes: #1166
Change-Id: I226408eed855b923172e5df0bdab005ed2cc9f53

2 years agoImprove typing to accommodate sqlalchemy v2
CaselIT [Fri, 10 Feb 2023 21:24:11 +0000 (22:24 +0100)] 
Improve typing to accommodate sqlalchemy v2

Index name can be null.

Fixes: #1168
Change-Id: Id7c944e19a9facd7d3862d43f84fd70aedace999

2 years agoset next version at 1.10.0
Mike Bayer [Sun, 26 Feb 2023 01:06:42 +0000 (20:06 -0500)] 
set next version at 1.10.0

Will rebase current 1.10 gerrits to this one until we are
very close to 1.10 issues being very close to ready for release.
In the interim, I'd rather not have an 0.9 branch for emergency
bugfixes.

We are mostly here waiting on I226408eed855b923172e5df0bdab005ed2cc9f53
for 1.10 to be close to release.

Change-Id: I9b568a19d6653ed54069b84187dcb10ad4150274

2 years agoUpdate docstring to suggest raw string (#1186)
Tim Penhey [Thu, 23 Feb 2023 21:17:57 +0000 (10:17 +1300)] 
Update docstring to suggest raw string (#1186)

* Update docstring to suggest raw string

When escaping the `:` for `op.execute` if a normal string is used, you need to escape the backslash, eg. `'\\:colon_value'` or using a raw string.
For the docs I feel it is nicer to show the raw string.

* Update stub documentation

Change-Id: Ia605c6c036fe82cebff9b427333404f1c59ea74d

---------

Co-authored-by: CaselIT <cfederico87@gmail.com>
2 years agoVersion 1.9.5 placeholder
Mike Bayer [Thu, 16 Feb 2023 17:38:03 +0000 (12:38 -0500)] 
Version 1.9.5 placeholder

2 years ago- 1.9.4 rel_1_9_4
Mike Bayer [Thu, 16 Feb 2023 17:35:31 +0000 (12:35 -0500)] 
- 1.9.4

2 years agoMerge "dont use server_default render_item for SQL compare" into main
mike bayer [Thu, 16 Feb 2023 15:10:29 +0000 (15:10 +0000)] 
Merge "dont use server_default render_item for SQL compare" into main

2 years agoMerge "collapse all chars for mssql defaults, move quoting" into main
mike bayer [Thu, 16 Feb 2023 15:10:23 +0000 (15:10 +0000)] 
Merge "collapse all chars for mssql defaults, move quoting" into main

2 years agodont use server_default render_item for SQL compare
Mike Bayer [Thu, 16 Feb 2023 02:34:30 +0000 (21:34 -0500)] 
dont use server_default render_item for SQL compare

Removed a mis-use of the
:paramref:`.EnvironmentContext.configure.render_item` callable where the
"server_default" renderer would be erroneously used within the server
default comparison process, which is working against SQL expressions, not
Python code.

Change-Id: Id6fad1e6f5ac0a68bbd0e6b7e6088e451bf6dc2b
References: #641
Fixes: #1180
2 years agoMerge "restore config object to merge command" into main
mike bayer [Wed, 15 Feb 2023 18:22:05 +0000 (18:22 +0000)] 
Merge "restore config object to merge command" into main

2 years agocollapse all chars for mssql defaults, move quoting
Mike Bayer [Tue, 14 Feb 2023 17:45:24 +0000 (12:45 -0500)] 
collapse all chars for mssql defaults, move quoting

Ongoing fixes for SQL Server server default comparisons under autogenerate,
adjusting for SQL Server's collapsing of whitespace between SQL function
arguments when reporting on a function-based server default, as well as its
arbitrary addition of parenthesis within arguments; the approach has now
been made more aggressive by stripping the two default strings to compare
of all whitespace, parenthesis, and quoting characters.

Fixed PostgreSQL server default comparison to handle SQL expressions
sent as ``text()`` constructs, such as ``text("substring('name', 1, 3)")``,
which previously would raise errors when attempting to run a server-based
comparison.

Change-Id: Icd861f62653fc7b3900164c0d047821125e1305e
Fixes: #1177
2 years agoFollow up Ia98c8f9a93953f049378f5029e355a3f249ed638
CaselIT [Tue, 14 Feb 2023 20:52:33 +0000 (21:52 +0100)] 
Follow up Ia98c8f9a93953f049378f5029e355a3f249ed638
that was merged prematurely

Change-Id: I131dfb8dabf10457954f5216b1abadc976aebd38

2 years agorestore config object to merge command
Brendan Gann [Tue, 14 Feb 2023 16:03:09 +0000 (11:03 -0500)] 
restore config object to merge command

Fixed regression introduced in 1.7.0 where the "config" object passed to
the template context when running the :func:`.merge` command
programmatically failed to be correctly populated. Pull request courtesy
Brendan Gann.

Closes: #1176
Pull-request: https://github.com/sqlalchemy/alembic/pull/1176
Pull-request-sha: cf6a886915f6bef6eeef8041804e316038955402

Change-Id: Idbab2dc0339cce6f8827d2f49156791600a82c1a

2 years agoMerge "Update annotation to allow PathLike" into main
mike bayer [Tue, 14 Feb 2023 15:46:06 +0000 (15:46 +0000)] 
Merge "Update annotation to allow PathLike" into main

2 years agoInclude missing part of env.py
Sam Bull [Mon, 13 Feb 2023 20:36:06 +0000 (15:36 -0500)] 
Include missing part of env.py

This part is missing from the example, and if a user started with the async template, then they would have an `asyncio.run()` call in here, which breaks the script.

Fixes: #1174
Closes: #1172
Pull-request: https://github.com/sqlalchemy/alembic/pull/1172
Pull-request-sha: fa2c55319d09fab4e1435433fa2d7e5fca5dc820

Change-Id: Ia98c8f9a93953f049378f5029e355a3f249ed638

2 years agoUpdate annotation to allow PathLike
Sam Bull [Mon, 13 Feb 2023 20:57:29 +0000 (15:57 -0500)] 
Update annotation to allow PathLike

The value is only used in os.path.abspath(), so it works fine with Path.

Closes: #1173
Pull-request: https://github.com/sqlalchemy/alembic/pull/1173
Pull-request-sha: 7cf9606602bb5692ddeb3551500be0dd956bd5d9

Change-Id: Ic629a7290464291377d066e856a8ae8a3f6505bc

2 years agouse correct param name
Mike Bayer [Mon, 13 Feb 2023 14:00:29 +0000 (09:00 -0500)] 
use correct param name

Change-Id: I2981335a5deaa798195cfe70f3655d79cd4d8a3b

2 years agopin sphinx-copybutton and change config
Mike Bayer [Thu, 9 Feb 2023 17:11:31 +0000 (12:11 -0500)] 
pin sphinx-copybutton and change config

sphinx-copybutton introduced a new feature
in 0.5.1 which includes a default configuration
that breaks the regexp prompt matching scheme.

set copybutton_exclude to not include ".gp" as that's the class
where we exactly look for the prompts we are matching.

pin sphinx-copybutton at 0.5.1 to avoid future problems.

Change-Id: Ie03bc27a9190e71b63fc68b484f23e53b8cb72dc
References: https://github.com/executablebooks/sphinx-copybutton/issues/185

2 years agoVersion 1.9.4 placeholder
Mike Bayer [Tue, 7 Feb 2023 20:48:43 +0000 (15:48 -0500)] 
Version 1.9.4 placeholder

2 years ago- 1.9.3 rel_1_9_3
Mike Bayer [Tue, 7 Feb 2023 20:47:07 +0000 (15:47 -0500)] 
- 1.9.3

2 years agoadd variant render step for user-defined types
Mike Bayer [Tue, 7 Feb 2023 04:30:58 +0000 (23:30 -0500)] 
add variant render step for user-defined types

due to SQLA 2.0's variant being integrated into types,
the variant rendering conditional would no longer take effect
as the type was not under the "sqlalchemy" module namespace.

Fixed issue where rendering of user-defined types that then went onto use
the ``.with_variant()`` method would fail to render, if using SQLAlchemy
2.0's version of variants.

Change-Id: I3c6f14325d6dffb2ddc1bf955753ee5a2de2cedd
Fixes: #1167
2 years agoRename teardown() method to avoid PytestRemovedIn8Warning
Gord Thompson [Wed, 25 Jan 2023 18:22:22 +0000 (11:22 -0700)] 
Rename teardown() method to avoid PytestRemovedIn8Warning

pytest 7.2.1 issuing PytestRemovedIn8Warning

[method name] is using nose-specific method: `teardown(self)`
To remove this warning, rename it to `teardown_method(self)`

Change-Id: I0674aaec2fe174ec16bedba7d524bc20fce6d219

2 years agoVersion 1.9.3 placeholder
Mike Bayer [Sat, 14 Jan 2023 19:15:45 +0000 (14:15 -0500)] 
Version 1.9.3 placeholder

2 years ago- 1.9.2 rel_1_9_2
Mike Bayer [Sat, 14 Jan 2023 19:11:02 +0000 (14:11 -0500)] 
- 1.9.2

2 years agoAdd commit to cookbook example
CaselIT [Wed, 11 Jan 2023 20:17:33 +0000 (21:17 +0100)] 
Add commit to cookbook example

A commit is now required to end the transaction before start
executing the migration

Fixes: #1150
Change-Id: I704db15155454dafed9d15f768b97f8e2ebfff81

2 years agorepair regression in SQL Server server default comapre logic
Mike Bayer [Tue, 10 Jan 2023 21:51:49 +0000 (16:51 -0500)] 
repair regression in SQL Server server default comapre logic

Fixed regression caused by :ticket:`1145` where the string transformations
applied to server defaults caused expressions such as ``(getdate())`` to no
longer compare as equivalent on SQL Server, others.

Change-Id: I9c611edd70765487746f652c9eb09e54d935da28
Fixes: #1152
2 years agoMerge "add overload stubs for proxied classes" into main
mike bayer [Tue, 3 Jan 2023 18:00:36 +0000 (18:00 +0000)] 
Merge "add overload stubs for proxied classes" into main

2 years agohappy new year 2023
Mike Bayer [Tue, 3 Jan 2023 17:51:53 +0000 (12:51 -0500)] 
happy new year 2023

Change-Id: Ia163c800e074443b92cd59c786ac09073267c271

2 years agoadd overload stubs for proxied classes
Vincent Fazio [Tue, 3 Jan 2023 17:39:13 +0000 (12:39 -0500)] 
add overload stubs for proxied classes

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

### Description
Closes #1146
Closes #1147

<!-- Describe your changes in detail -->

Overloaded functions would not have type stubs generated by the stub generator for proxied classes. Now they will.

### 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.

Closes: #1148
Pull-request: https://github.com/sqlalchemy/alembic/pull/1148
Pull-request-sha: ed3c28cc78e57314b7a4e533d77108efc6751949

Change-Id: I7c0ee9d333015174ee6ab754909748f745af2ff9

2 years agoVersion 1.9.2 placeholder
Mike Bayer [Fri, 23 Dec 2022 19:28:29 +0000 (14:28 -0500)] 
Version 1.9.2 placeholder

2 years ago- 1.9.1 rel_1_9_1
Mike Bayer [Fri, 23 Dec 2022 19:26:23 +0000 (14:26 -0500)] 
- 1.9.1

2 years agoMerge "dont use repr to quote string in compare_server_default" into main
mike bayer [Fri, 23 Dec 2022 19:25:13 +0000 (19:25 +0000)] 
Merge "dont use repr to quote string in compare_server_default" into main

2 years agodont use repr to quote string in compare_server_default
Mike Bayer [Thu, 22 Dec 2022 23:41:20 +0000 (18:41 -0500)] 
dont use repr to quote string in compare_server_default

Fixed issue where server default compare would not work for string defaults
that contained backslashes, due to mis-rendering of these values when
comparing their contents.

The server default comparison still has a lot of not-robust behaviors,
however at least get in place a parameterized test suite so that we
can add new scenarios quickly.

Made a slight adjustment to SQLite's compare server default implementation
to better handle defaults with or without parens around them, from both
the reflected and the local metadata side.

Implemented basic server default comparison for the Oracle backend;
previously, Oracle's formatting of reflected defaults prevented any
matches from occurring.

Change-Id: If5a69eec4b22d243a564d2c89e78ae33ba5be88f
Fixes: #1145
2 years agoVersion 1.9.1 placeholder
Mike Bayer [Thu, 15 Dec 2022 18:09:38 +0000 (13:09 -0500)] 
Version 1.9.1 placeholder

2 years ago- 1.9.0 rel_1_9_0
Mike Bayer [Thu, 15 Dec 2022 18:04:05 +0000 (13:04 -0500)] 
- 1.9.0

2 years agoadd check command for upgrade diffs
Nathan Louie [Tue, 13 Dec 2022 17:58:09 +0000 (12:58 -0500)] 
add check command for upgrade diffs

Added new Alembic command ``alembic check``. This performs the widely
requested feature of running an "autogenerate" comparison between the
current database and the :class:`.MetaData` that's currently set up for
autogenerate, returning an error code if the two do not match, based on
current autogenerate settings. Pull request courtesy Nathan Louie.

As this is a new feature we will call this 1.9.0

Fixes: #724
Closes: #1101
Pull-request: https://github.com/sqlalchemy/alembic/pull/1101
Pull-request-sha: 807ed545df70e7a10b913e2951a1b636f138a4ff

Change-Id: I03b146eaf762be464a0ff0858ff5730cc9366c84

2 years agotry to restore color to pytest
Mike Bayer [Sun, 11 Dec 2022 20:25:34 +0000 (15:25 -0500)] 
try to restore color to pytest

the problem here is that the color codes will come out in
jenkins runs.  see if jenkins maybe does something with that
(filters or maybe even gives us color)

Change-Id: I9c8660fa85fb216cae16e18b776f34b005d3ac51

2 years agoadjust for tox changes to passenv
Mike Bayer [Sun, 11 Dec 2022 16:31:10 +0000 (11:31 -0500)] 
adjust for tox changes to passenv

Fixed issue in tox.ini file where changes in the tox 4.0 series to the
format of "passenv" caused tox to not function correctly, in particular
raising an error as of tox 4.0.6.

Change-Id: I659c8fc523a71deaa02a89103c9e7241cf81d831
References: https://github.com/tox-dev/tox/issues/2676

2 years agoadd width + overflow to keep toc from flowing out of sidebar
Mike Bayer [Mon, 28 Nov 2022 20:54:11 +0000 (15:54 -0500)] 
add width + overflow to keep toc from flowing out of sidebar

also add sphinx-autobuild to the makefile

Change-Id: I7abd08cefe98d6b57394fad20bd06c3e0b928465
References: https://github.com/sphinx-doc/sphinx/issues/11000
(cherry picked from commit 9eafd483018775d9e1144512ed820ba2a80d2e61)

2 years agorun pyupgrade
Mike Bayer [Fri, 25 Nov 2022 17:29:40 +0000 (12:29 -0500)] 
run pyupgrade

command is:

find alembic -name "*.py" | xargs pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format

I'm having some weird fighting with the tools/write_pyi, where
in different runtime contexts it keeps losing "MigrationContext"
and also Callable drops the args, but it's not consisistent.
For whatever reason, under py311 things *do* work every time.
im working w/ clean tox environments so not really sure what the
change is.  anyway, let's at least fix the quoting up
around the types.

This is towards getting the "*" in the op signatures for #1130.

Change-Id: I9175905d3b4325e03a97d6752356b70be20e9fad

2 years agoMerge "add typing parameters" into main
mike bayer [Wed, 16 Nov 2022 00:01:14 +0000 (00:01 +0000)] 
Merge "add typing parameters" into main

2 years agoadd typing parameters
Mike Bayer [Mon, 7 Nov 2022 18:05:08 +0000 (13:05 -0500)] 
add typing parameters

Fixed typing issue where :paramref:`.revision.process_revision_directives`
was not fully typed; additionally ensured all ``Callable`` and ``Dict``
arguments to :meth:`.EnvironmentContext.configure` include parameters in
the typing declaration.

Change-Id: I3ac389992f357359439be5659af33525fc290f96
Fixes: #1110
2 years agoUpdated cookbook docs (#1111)
Amel Alispahic [Mon, 7 Nov 2022 19:47:20 +0000 (20:47 +0100)] 
Updated cookbook docs (#1111)

2 years agofix search path indicator
Mike Bayer [Mon, 17 Oct 2022 12:52:55 +0000 (08:52 -0400)] 
fix search path indicator

Change-Id: I341a57f0bbf7c237c86cb8de4c94a37d737c3c85
Fixes: #1096
2 years agouse SQLAlchemy built-in password obfuscation
Mike Bayer [Fri, 23 Sep 2022 14:44:17 +0000 (10:44 -0400)] 
use SQLAlchemy built-in password obfuscation

As str(url) will be changing to obfuscate the PW,
use SQLA 1.3 / 1.4 / 2.0 functionality directly.

Change-Id: I4694cc6d2ed7f0463fe0fae8a93ee9ec5df74760
References: https://github.com/sqlalchemy/sqlalchemy/issues/8567

2 years agoImprove typing
CaselIT [Sun, 11 Sep 2022 20:38:46 +0000 (22:38 +0200)] 
Improve typing

Change-Id: I9fc86c4a92e1b76d19c9e891ff08ce8a46ad4e35

2 years agoAdd missing types to **kw
eykamp [Thu, 8 Sep 2022 20:50:30 +0000 (16:50 -0400)] 
Add missing types to **kw

Simple change to fix (some) type checking with Pyright and friends.

Add missing types to **kw

Simple update to types, consistent with other similar instances already in place.

<!-- 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:  somewhere between the first and second options.  I don't think it merits an issue or test coverage.

- [ ] 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: #1073
Pull-request: https://github.com/sqlalchemy/alembic/pull/1073
Pull-request-sha: 34f0e38e7193a65b659e8af7fff553427048f536

Change-Id: I5f84478e59a74d3d841ff32a0c536e5b32cc9b21

2 years agoFix typo in docs/build/api/runtime.rst (#1084)
Johnny Deuss [Thu, 8 Sep 2022 20:46:12 +0000 (21:46 +0100)] 
Fix typo in docs/build/api/runtime.rst (#1084)

3 years agoadd docs for naming convention bypass case
Mike Bayer [Tue, 19 Jul 2022 16:01:50 +0000 (12:01 -0400)] 
add docs for naming convention bypass case

Change-Id: I8d604eaab7865466b8a7008693621c00f954397d
References: #453

3 years agoMerge "Ignore reflected expression based indexes" into main
Federico Caselli [Thu, 14 Jul 2022 17:19:43 +0000 (17:19 +0000)] 
Merge "Ignore reflected expression based indexes" into main

3 years agoIgnore reflected expression based indexes
CaselIT [Mon, 4 Jul 2022 20:47:20 +0000 (22:47 +0200)] 
Ignore reflected expression based indexes

this establishes forwads-compatibility for
PostgreSQL expression-based index reflection
being added in I3e36d557235286c0f7f6d8276272ff9225058d48

Change-Id: I81d7832f254f50dc3417dd3437c2b49ec3a549e2

3 years agoVersion 1.8.2 placeholder
Mike Bayer [Wed, 13 Jul 2022 14:19:10 +0000 (10:19 -0400)] 
Version 1.8.2 placeholder

3 years ago- 1.8.1 rel_1_8_1
Mike Bayer [Wed, 13 Jul 2022 14:17:20 +0000 (10:17 -0400)] 
- 1.8.1

3 years agobuild fixes
Mike Bayer [Wed, 13 Jul 2022 14:02:53 +0000 (10:02 -0400)] 
build fixes

* hardcode rev ids in test that's sensitive to overlapping
  substrings
* turn off nitpicky mode
* fix a few rst keywords
* ensure unreleased files not considered as indexable

Change-Id: I31a0f2cbf40c794204c1e7dbc68bfcf43992c65f

3 years agoimplement SQLite RENAME TABLE w schema syntax
Mike Bayer [Tue, 12 Jul 2022 23:36:57 +0000 (19:36 -0400)] 
implement SQLite RENAME TABLE w schema syntax

Fixed bug where the SQLite implementation of
:meth:`.Operations.rename_table` would render an explicit schema name for
both the old and new table name, which while is the standard ALTER syntax,
is not accepted by SQLite's syntax which doesn't support a rename across
schemas. In particular, the syntax issue would prevent batch mode from
working for SQLite databases that made use of attached databases (which are
treated as "schemas" in SQLAlchemy).

Change-Id: I02d8163b39cd33568c7528158218828ff0813695
Fixes: #1065
3 years agoadd FUNDING
Mike Bayer [Wed, 6 Jul 2022 17:01:42 +0000 (13:01 -0400)] 
add FUNDING

Change-Id: I5fabab14fd88092dd622b7f575c0209b5fb46c7c

3 years agoignore typing issue
Mike Bayer [Fri, 1 Jul 2022 18:38:57 +0000 (14:38 -0400)] 
ignore typing issue

Change-Id: Idb07f3aaa172a216055309876acd7a6ddb1d325a