]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/log
thirdparty/sqlalchemy/alembic.git
3 years agofix connection handling in consumption test
Mike Bayer [Fri, 11 Feb 2022 15:33:09 +0000 (10:33 -0500)] 
fix connection handling in consumption test

these tests were leaving connections opened.

This rev is necessary for tests to pass assuming
QueuePool for SQLite file connections, in
I5f6c259def0ef43d401c6163dc99f651e519148d

Change-Id: I5f6c259def0ef43d401c6163dc99f651e519148d

3 years agoadd conditional for fileConfig()
Mike Bayer [Mon, 7 Feb 2022 19:52:03 +0000 (14:52 -0500)] 
add conditional for fileConfig()

The ``fileConfig()`` line in the ``env.py`` templates is now conditional on
``Config.config_file_name`` not being None.

Change-Id: Ibe943d093fd872c4d0a836f58e0608a4e078ce1f
Fixes: #986
3 years agoPrevent alter_column() from changing nullability
Gord Thompson [Thu, 13 Jan 2022 18:46:46 +0000 (11:46 -0700)] 
Prevent alter_column() from changing nullability

Fixed bug where an alter_column() operation would change a "NOT NULL"
column to "NULL" by emitting an ALTER COLUMN statement that did not specify
"NOT NULL". (In the absence of "NOT NULL" T-SQL was implicitly assuming
"NULL"). An alter_column() operation that specifies `type_=` should also
specify either `nullable=` or `existing_nullable=` to inform Alembic as to
whether the emitted DDL should include "NULL" or "NOT NULL"; a warning is
now emitted if this is missing under this scenario.

Fixes: #977
Change-Id: Ifbaa06bf149ba39d1a5deb43a6fd42c9ca118894

3 years agoclarify default configuration behavior
Mike Bayer [Fri, 4 Feb 2022 16:51:30 +0000 (11:51 -0500)] 
clarify default configuration behavior

alembic does not by default read other sections
besides ``[alembic]``, however the generated ``env.py``
file by default contains instructions to also read logging
directives.  clarify that if the configuration file is
customized to not have logging directives, env.py also
needs to be customized.

Change-Id: I4804ce54b78b68c2d72ba4bcc7c1ecaf93a09103
Fixes: #985
3 years agofix pep484 issue
Mike Bayer [Tue, 1 Feb 2022 15:35:23 +0000 (10:35 -0500)] 
fix pep484 issue

the jenkins pep484 job wasn't catching the tox target
so we missed a mypy failure that got released :/

Change-Id: Ibaee3158971985fb08e43a53f99244bcc4fa0f81

3 years agoVersion 1.7.7 placeholder
Mike Bayer [Tue, 1 Feb 2022 15:02:28 +0000 (10:02 -0500)] 
Version 1.7.7 placeholder

3 years ago- 1.7.6 rel_1_7_6
Mike Bayer [Tue, 1 Feb 2022 15:00:09 +0000 (10:00 -0500)] 
- 1.7.6

3 years agohappy new year
Mike Bayer [Tue, 1 Feb 2022 14:59:05 +0000 (09:59 -0500)] 
happy new year

Change-Id: Ieaacc9d126d88f54d585e6380dd6bd56aa5919c2

3 years agoresolve for variant before testing for schema type
Mike Bayer [Tue, 1 Feb 2022 14:12:17 +0000 (09:12 -0500)] 
resolve for variant before testing for schema type

Fixed regression where usage of a ``with_variant()`` datatype in
conjunction with the ``existing_type`` option of ``op.alter_column()``
under batch mode would lead to an internal exception.

note this exception would only occur under 1.x, under 2.0
the new variant architecture would have prevented this problem,
however it is best here that the ultimate variant type is
unwrapped in the case that we have a plain type with a
schema type as a variant.

also sqla 1.3 needs pytest < 7 to run correctly

Change-Id: I0f5480f97f014e707b8bd4e70f8495d3bd27fd21
Fixes: #982
3 years agoadd pep484 target
Mike Bayer [Thu, 20 Jan 2022 18:31:29 +0000 (13:31 -0500)] 
add pep484 target

this is now the mypy target that the jenkins gerrit
job will access.

Change-Id: Iaa2bdbe8c4da683d7704a50be8ff3d9e7f887e09

3 years agoInsert spaces in warning and error messages 976/head
Harutaka Kawamura [Tue, 11 Jan 2022 07:08:43 +0000 (16:08 +0900)] 
Insert spaces in warning and error messages

3 years agoProvide useful error message in stub tests
CaselIT [Wed, 1 Dec 2021 21:11:36 +0000 (22:11 +0100)] 
Provide useful error message in stub tests

Change-Id: I6d2662cb5c13d5438210aa001cbdb8c7eb876bb7

3 years agoRemove warning regarding cache key when using MSSQL.
CaselIT [Tue, 28 Dec 2021 21:15:32 +0000 (22:15 +0100)] 
Remove warning regarding cache key when using MSSQL.

Change-Id: I5eacf7c2030d8dbdaf1e5d2eba836a7596365ae3

3 years agoadd missing import in asyncion cookbook example
CaselIT [Tue, 21 Dec 2021 19:27:01 +0000 (20:27 +0100)] 
add missing import in asyncion cookbook example

Change-Id: Idda470d2aa7df298e5553359be1ced07e2c112d0

3 years agofix type errors raised by mypy .920
CaselIT [Tue, 21 Dec 2021 19:17:39 +0000 (20:17 +0100)] 
fix type errors raised by mypy .920

Change-Id: Ifca989610193074757dec6602af268ea5139c4bc

3 years agodocs: Add missing engine.dispose() call to the asyncio cookbook example. (#973)
DanCardin [Tue, 21 Dec 2021 19:07:23 +0000 (14:07 -0500)] 
docs: Add missing engine.dispose() call to the asyncio cookbook example. (#973)

3 years agoRemove usage of no longer needed compat code
CaselIT [Tue, 23 Nov 2021 20:51:23 +0000 (21:51 +0100)] 
Remove usage of no longer needed compat code

Change-Id: I3180931673496260614e69e95f7da09d68b51714

3 years agoMerge remote-tracking branch 'github/pr/969'
Mike Bayer [Tue, 23 Nov 2021 16:22:43 +0000 (11:22 -0500)] 
Merge remote-tracking branch 'github/pr/969'

Change-Id: Ic6c07a214e372464c1d6303317caf98cfc3b0edf

3 years agoTweak docs about version_path_separator 969/head
Vlastimil Zíma [Thu, 18 Nov 2021 09:27:15 +0000 (10:27 +0100)] 
Tweak docs about version_path_separator

3 years agoMerge "Add new ensure_version command" into main
mike bayer [Thu, 18 Nov 2021 21:10:09 +0000 (21:10 +0000)] 
Merge "Add new ensure_version command" into main

3 years agoAdd new ensure_version command
Kai Mueller [Wed, 10 Nov 2021 16:38:11 +0000 (11:38 -0500)] 
Add new ensure_version command

Add a new command ``alembic ensure_version``, which will ensure that the
Alembic version table is present in the target database, but does not
alter its contents.  Pull request courtesy Kai Mueller.

Fixes: #964
Closes: #965
Pull-request: https://github.com/sqlalchemy/alembic/pull/965
Pull-request-sha: a85d2ac048c666126e583fbda482eeabd9c58c53

Change-Id: Ia39d43287634915537725e779dba7ac34f2946e4

3 years agoMerge "add type synonym for mysql.LONGTEXT / JSON" into main
mike bayer [Thu, 18 Nov 2021 15:54:27 +0000 (15:54 +0000)] 
Merge "add type synonym for mysql.LONGTEXT / JSON" into main

3 years agosupport 2.0 style variants
Mike Bayer [Tue, 16 Nov 2021 19:10:58 +0000 (14:10 -0500)] 
support 2.0 style variants

Implemented support for recognizing and rendering SQLAlchemy "variant"
types going forward into SQLAlchemy 2.0, where the architecture of
"variant" datatypes will be changing.

Specifically any TypeEngine can now have "variants" by looking
in the _variant_mapping dictionary collection associated with the
type directly.

Change-Id: I0b5ca887dce1dd77af3504dbe318701b31c7d574

3 years agoadd type synonym for mysql.LONGTEXT / JSON
Mike Bayer [Sat, 13 Nov 2021 15:27:30 +0000 (10:27 -0500)] 
add type synonym for mysql.LONGTEXT / JSON

Added a rule to the MySQL impl so that the translation between JSON /
LONGTEXT is accommodated by autogenerate, treating LONGTEXT from the server
as equivalent to an existing JSON in the model.

Change-Id: Ia8370d2269c4decea00aa94beafd3d9d861a1269
Fixes: #968
3 years agoVersion 1.7.6 placeholder
Mike Bayer [Thu, 11 Nov 2021 15:56:19 +0000 (10:56 -0500)] 
Version 1.7.6 placeholder

3 years ago- 1.7.5 rel_1_7_5
Mike Bayer [Thu, 11 Nov 2021 15:55:00 +0000 (10:55 -0500)] 
- 1.7.5

3 years agoUpdate documentation about alembic configuration path 966/head
Madison Swain-Bowden [Thu, 11 Nov 2021 00:14:43 +0000 (16:14 -0800)] 
Update documentation about alembic configuration path

3 years agoadjust autocommit tests to accommodate for execution_options change
Mike Bayer [Fri, 5 Nov 2021 20:58:27 +0000 (16:58 -0400)] 
adjust autocommit tests to accommodate for execution_options change

the tests here were relying on the fact that execution_options
returns a new connection which is not the case for future mode.

Change-Id: Ib6c2c69243a615fa2097c68fc5c35c14507bea61

3 years agouse a heuristic for pure "future engine" until future engine merges
Mike Bayer [Fri, 5 Nov 2021 16:19:12 +0000 (12:19 -0400)] 
use a heuristic for pure "future engine" until future engine merges

Change-Id: I0d5605091c3010ce50bcd0083dfb3c9615212d22

3 years agosqlalchemy 2.0 test updates
Mike Bayer [Fri, 5 Nov 2021 15:24:23 +0000 (11:24 -0400)] 
sqlalchemy 2.0 test updates

- disable branched connection tests for 2.x
- dont use future flag for 2.x
- adjust batch tests for autobegin, inconsistent
  SQLite transactional DDL behaviors

Change-Id: I70caf6afecc83f880dc92fa6cbc29e2043c43bb9

3 years agofix annotation
Mike Bayer [Fri, 5 Nov 2021 04:05:07 +0000 (00:05 -0400)] 
fix annotation

Change-Id: Iae921dd45d78e9c657304a2977adb18b0191a20d

3 years agorollback connection before teardown
Mike Bayer [Fri, 5 Nov 2021 03:49:15 +0000 (23:49 -0400)] 
rollback connection before teardown

this test needs to clear out the transaction
if running on SQLAlchemy 2.0.

Change-Id: Ic3f76433ba9b9ea5485a81caae745d3c7f2a4ee8

3 years agoworkflow: also test against rel_1_4
CaselIT [Thu, 4 Nov 2021 20:50:07 +0000 (21:50 +0100)] 
workflow: also test against rel_1_4

Change-Id: I68c8a06c9d8baefdb6736e701be33b730eff7442

3 years agoworkflows; skip py3.6 when testing against main, add py3.10
CaselIT [Thu, 4 Nov 2021 20:37:47 +0000 (21:37 +0100)] 
workflows; skip py3.6 when testing against main, add py3.10

Change-Id: Ia847a906ed64a3a9bef4c8a72b732e1c156e9a85

3 years agodont hardcode transaction opened messaging
Mike Bayer [Thu, 4 Nov 2021 18:34:07 +0000 (14:34 -0400)] 
dont hardcode transaction opened messaging

Adjustments to the test suite to accommodate for error message changes
occurring as of SQLAlchemy 1.4.27.

Change-Id: I5092c8d3ba3d16819b200f1dfc3c30b8d24abe30

3 years agoRemove code to force ENABLE_ASYNCIO to False
Gord Thompson [Sat, 23 Oct 2021 17:24:40 +0000 (11:24 -0600)] 
Remove code to force ENABLE_ASYNCIO to False

Forcing ENABLE_ASYNCIO to False was interfering
with testing under async drivers when the
(third-party dialect) test suite included both
SQLAlchemy and Alembic tests.

Change-Id: I2fe40049c24ba8eba0a10011849a912c03aa381e

3 years agoAdjust test requirements for mssql
Gord Thompson [Sat, 23 Oct 2021 22:41:19 +0000 (16:41 -0600)] 
Adjust test requirements for mssql

SQLAlchemy added FK onupdate/ondelete reflection
in 1.4.26

Change-Id: Ie4e95294fe3857ea1f28a67a7a78ca9213e8e8f8

3 years agoensure connection is not None
Mike Bayer [Sat, 23 Oct 2021 19:58:37 +0000 (15:58 -0400)] 
ensure connection is not None

the inspect() API changed in
https://github.com/sqlalchemy/sqlalchemy2-stubs/commit/68f8417888456588714fcced1c6799f3eb00ff2d
to be more accurate which correctly appears to necessitate a
type check in Alembic AutogenContext.inspector() to ensure
"self.connection" isn't None

Change-Id: Icb3c73be62dc14d9a8f88e0723c3651b6628739a

3 years agomain name for github workflows
Mike Bayer [Mon, 11 Oct 2021 16:18:20 +0000 (12:18 -0400)] 
main name for github workflows

Change-Id: I0c32212f1b96acb691c29f013cfa78e1ae228cfc

3 years agorename to main
Mike Bayer [Mon, 11 Oct 2021 15:28:04 +0000 (11:28 -0400)] 
rename to main

Change-Id: I6cff33e68cbb2735f3fda22433c36e565a3d5e7a

3 years agoFix issue 928 create_check_constraint condition argument typing fix (#929)
liverpool1026 [Thu, 7 Oct 2021 19:46:58 +0000 (05:46 +1000)] 
Fix issue 928 create_check_constraint condition argument typing fix (#929)

* Update create_check_constraint method typing

* Pass str type down

Fixes: #928
Co-authored-by: Kevin Hwa <liverpoo1026.bne@gmail.com>
Co-authored-by: Kevin Hwa <kevin.hwa@polymathian.com>
3 years agoAdd `[post_write_hooks]` to example `alembic.ini` 946/head
Anatoli Babenia [Thu, 7 Oct 2021 06:47:32 +0000 (09:47 +0300)] 
Add `[post_write_hooks]` to example `alembic.ini`

3 years agoVersion 1.7.5 placeholder
Mike Bayer [Wed, 6 Oct 2021 14:31:50 +0000 (10:31 -0400)] 
Version 1.7.5 placeholder

3 years ago- 1.7.4 rel_1_7_4
Mike Bayer [Wed, 6 Oct 2021 14:13:39 +0000 (10:13 -0400)] 
- 1.7.4

3 years agoMerge "frame a transaction around autocommit"
mike bayer [Tue, 5 Oct 2021 13:25:23 +0000 (13:25 +0000)] 
Merge "frame a transaction around autocommit"

3 years agoframe a transaction around autocommit
Mike Bayer [Mon, 4 Oct 2021 19:15:16 +0000 (15:15 -0400)] 
frame a transaction around autocommit

Fixed issue where the :meth:`.MigrationContext.autocommit_block` feature
would fail to function when using a SQLAlchemy engine using 2.0 future
mode.

Change-Id: I851573424c7cde2595ae22c816ec6580d7cab248
Fixes: #944
3 years agoFix write hook issue in python < 3.9.
Federico Caselli [Thu, 30 Sep 2021 13:06:13 +0000 (15:06 +0200)] 
Fix write hook issue in python < 3.9.

Adjust require of importlib_metadata also include py3.8.

Fixes: #934
Change-Id: Id64163a0dc53226d62795d40190b6cec0aee522b

3 years agoMultiDB README: Add a bit more detail 932/head
Chris Dary [Fri, 24 Sep 2021 19:47:08 +0000 (15:47 -0400)] 
MultiDB README: Add a bit more detail

3 years agoVersion 1.7.4 placeholder
Mike Bayer [Fri, 17 Sep 2021 15:29:34 +0000 (11:29 -0400)] 
Version 1.7.4 placeholder

3 years ago- 1.7.3 rel_1_7_3
Mike Bayer [Fri, 17 Sep 2021 15:28:22 +0000 (11:28 -0400)] 
- 1.7.3

3 years agoMerge "Fix constraint_name type of create_foreign_key"
mike bayer [Fri, 17 Sep 2021 15:27:41 +0000 (15:27 +0000)] 
Merge "Fix constraint_name type of create_foreign_key"

3 years agoVersion 1.7.3 placeholder
Mike Bayer [Fri, 17 Sep 2021 14:06:36 +0000 (10:06 -0400)] 
Version 1.7.3 placeholder

3 years ago- 1.7.2 rel_1_7_2
Mike Bayer [Fri, 17 Sep 2021 13:59:36 +0000 (09:59 -0400)] 
- 1.7.2

3 years agoFix constraint_name type of create_foreign_key
TilmanK [Tue, 14 Sep 2021 19:39:59 +0000 (15:39 -0400)] 
Fix constraint_name type of create_foreign_key

Fixed type annotations for the "constraint_name" argument of operations
``create_primary_key()``, ``create_foreign_key()``.  Pull request courtesy
TilmanK.

Closes: #914
Pull-request: https://github.com/sqlalchemy/alembic/pull/914
Pull-request-sha: 39d44af226b2103da3964daf3229880a0958b97c

Change-Id: Iec4b392c70ae0eeda06dcbfda95a2f044e976686

3 years agoMerge "render 3rd party module annotations as forward references"
mike bayer [Fri, 17 Sep 2021 13:23:00 +0000 (13:23 +0000)] 
Merge "render 3rd party module annotations as forward references"

3 years agorender 3rd party module annotations as forward references
Mike Bayer [Wed, 15 Sep 2021 20:43:45 +0000 (16:43 -0400)] 
render 3rd party module annotations as forward references

Fixed issue where registration of custom ops was prone to failure due to
the registration process running ``exec()`` on generated code that as of
the 1.7 series includes pep-484 annotations, which in the case of end user
code would result in name resolution errors when the exec occurs. The logic
in question has been altered so that the annotations are rendered as
forward references so that the ``exec()`` can proceed.

Change-Id: I142b89e2f6354b2ce253f3b8109f59fa3aae68ef
Fixes: #920
3 years agoAdded missing attributes from context stubs.
CaselIT [Mon, 6 Sep 2021 21:22:30 +0000 (23:22 +0200)] 
Added missing attributes from context stubs.

Fixes: #900
Change-Id: I2e21b6f363bf6405bd472c9aca04fbbc3c9cc384

3 years agoAdds exception when trying to run write_pyi.py with Python < 3.9
TilmanK [Tue, 14 Sep 2021 19:43:30 +0000 (15:43 -0400)] 
Adds exception when trying to run write_pyi.py with Python < 3.9

### Description
write_pyi.py now raises an exception when someone tries to run the script with Python version 3.8 or smaller.

This also fixes:
- When using absolute Paths, i.e. on Windows, they are now converted to relative paths to avoid useless changes in the doc strings of the pyi files
- Corrected destination_path argument type when calling `generate_pyi_for_proxy` in `run_file`
- A comment typo

Fixes: #915
Closes: #919
Pull-request: https://github.com/sqlalchemy/alembic/pull/919
Pull-request-sha: e885d27ac5509858c8cb2927310f6195fc1d6004

Change-Id: Ia33d32b2828e71185186afc49848ce89d48a8323

3 years agoMerge "use in-package imports"
mike bayer [Tue, 14 Sep 2021 17:00:08 +0000 (17:00 +0000)] 
Merge "use in-package imports"

3 years agouse in-package imports
Mike Bayer [Mon, 13 Sep 2021 18:58:06 +0000 (14:58 -0400)] 
use in-package imports

Fixed an import in one of the .pyi files that was triggering an
assertion error in some versions of mypy.

Change-Id: Ifc663a876ebe5bebf8411c1eb451f2a25fe4dec0
Fixes: #897
3 years agoMerge branch 'workflow_test_mypy' into master-gerrit
CaselIT [Mon, 13 Sep 2021 19:19:07 +0000 (21:19 +0200)] 
Merge branch 'workflow_test_mypy' into master-gerrit
Change-Id: Ifb5f035a83341b4ccf0d615ab4d6ba23ca7f1573

3 years agoAdd mypy to the github workflow 918/head
CaselIT [Mon, 13 Sep 2021 19:11:22 +0000 (21:11 +0200)] 
Add mypy to the github workflow

Fixes: #917
Change-Id: I77d8a3673eb6d990ca947c59f6960925561d122a

3 years agoMerge remote-tracking branch 'github/pr/911'
Mike Bayer [Mon, 13 Sep 2021 18:48:50 +0000 (14:48 -0400)] 
Merge remote-tracking branch 'github/pr/911'

Change-Id: Id661e1e1f81e0ab8e17dab2479d9223e425f471b

3 years agoFix/typos doc build (#910)
Kevin Kirsche [Sat, 11 Sep 2021 20:39:08 +0000 (16:39 -0400)] 
Fix/typos doc build (#910)

* fix: typos in docs/build/batch.rst

* fix: typos in docs/build/autogenerate.rst

* fix: typos in docs/build/changelog.rst

3 years agofix: typos in doc/build/api (#909)
Kevin Kirsche [Sat, 11 Sep 2021 20:37:23 +0000 (16:37 -0400)] 
fix: typos in doc/build/api (#909)

3 years ago[DOCS]: Remove suggestion to use branched connections 911/head
Chris Sewell [Sat, 11 Sep 2021 06:12:10 +0000 (08:12 +0200)] 
[DOCS]: Remove suggestion to use branched connections

Fixes #908

3 years agoadd missing resources from alembic doc build
Mike Bayer [Thu, 9 Sep 2021 12:27:21 +0000 (08:27 -0400)] 
add missing resources from alembic doc build

Change-Id: I0f1c3a67edf35ab9ea2b0ac0689f68e8b4dee99d
Fixes: #907
3 years agoclarify that only named check constraints are regenerated
Mike Bayer [Wed, 1 Sep 2021 14:57:00 +0000 (10:57 -0400)] 
clarify that only named check constraints are regenerated

Change-Id: Ie0489137122d6ccedfa7c1af44dc8420a0842ee8
References: #400

3 years agoVersion 1.7.2 placeholder
Mike Bayer [Mon, 30 Aug 2021 21:51:30 +0000 (17:51 -0400)] 
Version 1.7.2 placeholder

3 years ago- 1.7.1 rel_1_7_1
Mike Bayer [Mon, 30 Aug 2021 21:49:50 +0000 (17:49 -0400)] 
- 1.7.1

3 years agocheck all directives in batch block until recreate selected
Mike Bayer [Mon, 30 Aug 2021 20:02:02 +0000 (16:02 -0400)] 
check all directives in batch block until recreate selected

Fixed regression in batch mode due to :ticket:`883` where the "auto" mode
of batch would fail to accommodate any additional migration directives
beyond encountering an ``add_column()`` directive, due to a mis-application
of the conditional logic that was added as part of this change, leading to
"recreate" mode not being used in cases where it is required for SQLite
such as for unique constraints.

Change-Id: I6315569caff5f3b33d152974ebecc8b18d9cc523
Fixes: #896
3 years agorestore default values for keyword arguments in stubs
Mike Bayer [Mon, 30 Aug 2021 18:30:37 +0000 (14:30 -0400)] 
restore default values for keyword arguments in stubs

Fixed issue in generated .pyi files where default values for ``Optional``
arguments were missing, thereby causing mypy to consider them as required.

Change-Id: I08c4cd7bd04c6763fdc9c5b42abbdcca8fd90e0e
Fixes: #895
3 years agofix mypy errors
CaselIT [Mon, 30 Aug 2021 19:39:40 +0000 (21:39 +0200)] 
fix mypy errors

Change-Id: If49e0ff00f0b00ed914ddb8979ae49c3a8a10a0e

3 years agoDo not tag wheel as being compatible with Python 2
layday [Mon, 30 Aug 2021 17:30:05 +0000 (13:30 -0400)] 
Do not tag wheel as being compatible with Python 2

Corrected "universal wheel" directive in setup.cfg so that building a wheel
does not target Python 2. The PyPi files index for 1.7.0 was corrected
manually. Pull request courtesy layday.

Fixes: #893
Closes: #894
Pull-request: https://github.com/sqlalchemy/alembic/pull/894
Pull-request-sha: 577afdbe5906247493182df95fe5e5338ac23080

Change-Id: I26ca6d9e3e8064d22713926707a53cb57a69d8e7

3 years agoVersion 1.7.1 placeholder
Mike Bayer [Mon, 30 Aug 2021 15:12:17 +0000 (11:12 -0400)] 
Version 1.7.1 placeholder

3 years ago- 1.7.0 rel_1_7_0
Mike Bayer [Mon, 30 Aug 2021 15:02:39 +0000 (11:02 -0400)] 
- 1.7.0

3 years agobump importlib.resources req to 3.9
Mike Bayer [Fri, 27 Aug 2021 16:38:16 +0000 (12:38 -0400)] 
bump importlib.resources req to 3.9

The importlib.resources.files() API was not added until 3.9.

Change-Id: I62ef8974d6637394448346d7e0f86c6dd93f81a7

3 years agochangelog updates
Mike Bayer [Thu, 26 Aug 2021 22:37:35 +0000 (18:37 -0400)] 
changelog updates

Change-Id: I84519c685e2f0a7ac84fe866f33a8451cfc495e2

3 years agodecouple pyproject.toml from the test suite
Mike Bayer [Thu, 26 Aug 2021 22:25:29 +0000 (18:25 -0400)] 
decouple pyproject.toml from the test suite

tools/write_pyi.py is run as part of the test suite,
which has to run from a source distribution, which
does not have pyproject.toml right now due to
issues reported w/ pip.  these pip issues are probably
resolved now however we have not gone back to including
pyproject.toml at the moment.   so we therefore have to
hardcode the single "-l79" black config option in
write_pyi.py.

Change-Id: I877f69eb2322f6cbb39ed4c6d4a9adf598703223

3 years agoalso include py.typed
Mike Bayer [Thu, 26 Aug 2021 22:16:09 +0000 (18:16 -0400)] 
also include py.typed

Change-Id: I8f41eeaf517dfb52f1ddad0a3735f61545bea205

3 years agoadjust manifest to accommodate .pyi files
Mike Bayer [Thu, 26 Aug 2021 21:55:15 +0000 (17:55 -0400)] 
adjust manifest to accommodate .pyi files

Change-Id: I51c7c04c609dd008921e803596c53a48c8b247c0

3 years agoMerge "Add test to ensure method given in #880 works"
mike bayer [Wed, 25 Aug 2021 18:22:21 +0000 (18:22 +0000)] 
Merge "Add test to ensure method given in #880 works"

3 years agoAdd test to ensure method given in #880 works
Mike Bayer [Tue, 24 Aug 2021 15:02:52 +0000 (11:02 -0400)] 
Add test to ensure method given in #880 works

Change-Id: I05dae157320be49eb598084388196e72896bc89d
Fixes: #880
3 years agoMerge "remove dependency on pkg_resources"
mike bayer [Wed, 25 Aug 2021 17:26:49 +0000 (17:26 +0000)] 
Merge "remove dependency on pkg_resources"

3 years agoMerge "support named CHECK constraints in batch"
mike bayer [Tue, 24 Aug 2021 14:45:37 +0000 (14:45 +0000)] 
Merge "support named CHECK constraints in batch"

3 years agosupport named CHECK constraints in batch
Mike Bayer [Mon, 23 Aug 2021 17:31:57 +0000 (13:31 -0400)] 
support named CHECK constraints in batch

Named CHECK constraints are now supported by batch mode, and will
automatically be part of the recreated table assuming they are named. They
also can be explicitly dropped using ``op.drop_constraint()``. For
"unnamed" CHECK constraints, these are still skipped as they cannot be
distinguished from the CHECK constraints that are generated by the
``Boolean`` and ``Enum`` datatypes.

Note that this change may require adjustments to migrations that drop or
rename columns which feature an associated named check constraint, such
that an additional ``op.drop_constraint()`` directive should be added for
that named constraint as there will no longer be an associated column
for it; for the ``Boolean`` and ``Enum`` datatypes, an ``existing_type``
keyword may be passed to ``BatchOperations.drop_constraint`` as well.

Fixes: #884
Change-Id: I3694430f7c9735bcc3b0765893b333cc8e0d1cd3

3 years agoappend the path to write_pyi script.
CaselIT [Mon, 23 Aug 2021 22:14:58 +0000 (00:14 +0200)] 
append the path to write_pyi script.

This allows running without having alembic installed

Change-Id: I1cc4f108916233e7b149485a42cae759e7e3b577

3 years agoremove dependency on pkg_resources
Mike Bayer [Mon, 23 Aug 2021 20:24:26 +0000 (16:24 -0400)] 
remove dependency on pkg_resources

The dependency on ``pkg_resources`` which is part of ``setuptools`` has
been removed, so there is no longer any runtime dependency on
``setuptools``. The functionality has been replaced with
``importlib.metadata`` and ``importlib.resources`` which are both part of
Python std.lib, or via pypy dependency ``importlib-metadata`` for Python
version < 3.8 and ``importlib-resources`` for Python version < 3.7.

Change-Id: I7802fe72ff644f52ae2edde53bc8e16f016b7c45
Fixes: #885
3 years agoavoid importing ForwardRef that's py3.9+ only
CaselIT [Mon, 23 Aug 2021 18:54:00 +0000 (20:54 +0200)] 
avoid importing ForwardRef that's py3.9+ only

Change-Id: I76654f10e208d618e21ab0c884cb0abede4d6177

3 years agoMerge "Fix postgresql_include in create_index"
mike bayer [Mon, 23 Aug 2021 18:19:16 +0000 (18:19 +0000)] 
Merge "Fix postgresql_include in create_index"

3 years agoFix postgresql_include in create_index
Steven Bronson [Thu, 19 Aug 2021 16:06:25 +0000 (12:06 -0400)] 
Fix postgresql_include in create_index

Fixed issue where usage of the PostgreSQL ``postgresql_include`` option
within a :meth:`.Operations.create_index` would raise a KeyError, as the
additional column(s) need to be added to the table object used by the
construct internally. The issue is equivalent to the SQL Server issue fixed
in :ticket:`513`. Pull request courtesy Steven Bronson.

Copied from e01041b and 174cb4b.

Fixes: #874
Closes: #875
Pull-request: https://github.com/sqlalchemy/alembic/pull/875
Pull-request-sha: 2f9b51890a1296146bcea842dc8bbee53d1d11f5

Change-Id: I68cc2a75dafd3297c5121c5125ff9c463c74f777

3 years agogenerate .pyi files for proxied classes
Mike Bayer [Wed, 11 Aug 2021 19:58:16 +0000 (15:58 -0400)] 
generate .pyi files for proxied classes

Stub .pyi files have been added for the "dynamically"
generated Alembic modules ``alembic.op`` and ``alembic.context``, which
include complete function signatures and docstrings, so that the functions
in these namespaces will have both IDE support (vscode, pycharm, etc) as
well as support for typing tools like Mypy. The files themselves are
statically generated from their source functions within the source tree.

Still not available is sphinx autodoc from the .pyi file.  so
we might want to further modify this to write into the .py directly.

if we do *that*, we could almost get rid of ModuleClsProxy and
just generate proxying methods fully in op.py.  however, this won't work
for the "extending ops" use case.

Change-Id: I3f084040de25ed3f8e92a4e9d0bb83d69b78eac6

3 years agoAdd pep-484 type annotations
CaselIT [Sun, 18 Apr 2021 13:44:50 +0000 (15:44 +0200)] 
Add pep-484 type annotations

pep-484 type annotations have been added throughout the library. This
should be helpful in providing Mypy and IDE support, however there is not
full support for Alembic's dynamically modified "op" namespace as of yet; a
future release will likely modify the approach used for importing this
namespace to be better compatible with pep-484 capabilities.

Type originally created using MonkeyType

Add types extracted with the MonkeyType https://github.com/instagram/MonkeyType
library by running the unit tests using ``monkeytype run -m pytest tests``, then
``monkeytype apply <module>`` (see below for further details).
USed MonkeyType version 20.5 on Python 3.8, since newer version have issues

After applying the types, the new imports are placed in a ``TYPE_CHECKING`` guard
and all type definition of non base types are deferred by using the string notation.

NOTE: since to apply the types MonkeType need to import the module, also the test
ones, the patch below mocks the setup done by pytest so that the tests could be
correctly imported

diff --git a/alembic/testing/__init__.py b/alembic/testing/__init__.py
index bdd1746..b1090c7 100644

Change-Id: Iff93628f4b43c740848871ce077a118db5e75d41
--- a/alembic/testing/__init__.py
+++ b/alembic/testing/__init__.py
@@ -9,6 +9,12 @@ from sqlalchemy.testing.config import combinations
 from sqlalchemy.testing.config import fixture
 from sqlalchemy.testing.config import requirements as requires

+from sqlalchemy.testing.plugin.pytestplugin import PytestFixtureFunctions
+from sqlalchemy.testing.plugin.plugin_base import _setup_requirements
+
+config._fixture_functions = PytestFixtureFunctions()
+_setup_requirements("tests.requirements:DefaultRequirements")
+
 from alembic import util
 from .assertions import assert_raises
 from .assertions import assert_raises_message

Currently I'm using this branch of the sqlalchemy stubs:
https://github.com/sqlalchemy/sqlalchemy2-stubs/tree/alembic_updates

Change-Id: I8fd0700aab1913f395302626b8b84fea60334abd

3 years agofix release num in changelog
Mike Bayer [Wed, 11 Aug 2021 15:13:46 +0000 (11:13 -0400)] 
fix release num in changelog

Change-Id: I30540e78650c038f8fd5f6c8247bac7a28495bf7

3 years agoadd req for sqlite computed columns
Mike Bayer [Tue, 10 Aug 2021 19:41:38 +0000 (15:41 -0400)] 
add req for sqlite computed columns

older Python 3.6 has a sqlite that doesn't support this

Change-Id: Ie65ef7fabeae2f5142573247548dd50d6d1708dd

3 years agoMerge "qualify sqlite batch add column for dynamic defaults"
mike bayer [Tue, 10 Aug 2021 19:32:12 +0000 (19:32 +0000)] 
Merge "qualify sqlite batch add column for dynamic defaults"

3 years agoqualify sqlite batch add column for dynamic defaults
Mike Bayer [Sat, 7 Aug 2021 15:48:19 +0000 (11:48 -0400)] 
qualify sqlite batch add column for dynamic defaults

Batch "auto" mode will now select for "recreate" if the ``add_column()``
operation is used on SQLite, and the column itself meets the criteria for
SQLite where ADD COLUMN is not allowed, in this case a functional or
parenthesized SQL expression or a ``Computed`` (i.e. generated) column.

Change-Id: Ie948b4b8ad8dc698b458403831e47bac4ad45b8a
Fixes: #883
3 years agoPreserve comment and info in Drop/CreateTableOp
Nicolas CANIART [Tue, 10 Aug 2021 14:36:55 +0000 (10:36 -0400)] 
Preserve comment and info in Drop/CreateTableOp

Fixed regression due to :ticket:`803` where the ``.info`` and ``.comment``
attributes of ``Table`` would be lost inside of the :class:`.DropTableOp`
class, which when "reversed" into a :class:`.CreateTableOp` would then have
lost these elements. Pull request courtesy Nicolas CANIART.

Fixes: #879
Closes: #881
Pull-request: https://github.com/sqlalchemy/alembic/pull/881
Pull-request-sha: e509b9e8180085998e32746721eeb9266b9f2145

Change-Id: I84a0680266fcf80f3dc922f3cbc76dabd74eedd3

4 years agoCorrect typo in documention, closes #872 873/head
Adam Parkin [Mon, 12 Jul 2021 19:39:19 +0000 (12:39 -0700)] 
Correct typo in documention, closes #872

4 years agoAdd changelog entry for test suite
Gord Thompson [Thu, 1 Jul 2021 18:09:35 +0000 (12:09 -0600)] 
Add changelog entry for test suite

Change-Id: Ibb1aba8f714bc167068a58069426591b5361bf3a