| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
<!-- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Change-Id: I8d604eaab7865466b8a7008693621c00f954397d
References: #453
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
this establishes forwads-compatibility for
PostgreSQL expression-based index reflection
being added in I3e36d557235286c0f7f6d8276272ff9225058d48
Change-Id: I81d7832f254f50dc3417dd3437c2b49ec3a549e2
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added an error raise for the condition where
:meth:`.Operations.batch_alter_table` is used in ``--sql`` mode, where the
operation requires table reflection, as is the case when running against
SQLite without giving it a fixed ``Table`` object. Previously the operation
would fail with an internal error. To get a "move and copy" batch
operation as a SQL script without connecting to a database,
a ``Table`` object should be passed to the
:paramref:`.Operations.batch_alter_table.copy_from` parameter so that
reflection may be skipped.
Change-Id: I2d040e7e5771eefabba1649d71ed451567c25283
Fixes: #1021
|
|
|
|
|
|
|
| |
Make alembic test compatible with comments on constraint change
added in Ia60f578595afdbd6089541c9a00e37997ef78ad3
Change-Id: I9ad803df1d3ccf2a5111266b781061936717b8c8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ``op.drop_table()`` operation directive will now trigger the
``before_drop()`` and ``after_drop()`` DDL event hooks at the table level,
which is similar to how the ``before_create()`` and ``after_create()``
hooks are triggered by the ``op.create_table()`` directive. Note that as
``op.drop_table()`` accepts only a table name and optional schema name, the
``Table`` object received by the event will not have any information within
it other than the table name and schema name.
Fixes: #1037
Closes: #1036
Pull-request: https://github.com/sqlalchemy/alembic/pull/1036
Pull-request-sha: ea44e7f3398aa5001e86e6a7e30f61f6a86d9674
Change-Id: I20a1702e17ed88054206d964152ce05b81d0f89e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed issue in batch mode where CREATE INDEX would not use a new column
name in the case of a column rename.
Indexes were previously being moved to the new table without any
steps to rewrite columns. We now vendor the copy approach
from table.to_metadata so that there's a new index expressed
in terms of the new columns.
Change-Id: Ied84232037aee0b2bf2094b3d3474013d7b41b34
Fixes: #1034
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added new token ``epoch`` to the ``file_template`` option, which will
populate the integer epoch as determined by ``int(create_date.timestamp())``.
Pull request courtesy Caio Carvalho.
Fixes: #1027
Closes: #1028
Pull-request: https://github.com/sqlalchemy/alembic/pull/1028
Pull-request-sha: 27970cd5d4e047cb7aabd161c68b757b2ee3e4c4
Change-Id: I73e13009bae91e64681a605b3f0b62ea1e5fc464
|
|
|
|
|
|
|
|
|
| |
Fixed issue where downgrade using a relative revision would
fail in case of multiple branches with a single effectively
head due to interdependencies between revisions.
Fixes: #1026
Change-Id: I79f5595fb9d03124db8039345055571a9134eecd
|
|
|
|
| |
Change-Id: I778b63b1c438f31964d841576f0dd54ae1a5fadc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
<!-- Provide a general summary of your proposed changes in the Title field above -->
### Description
When working together with `mypy` we have a problem with the default template.
`mypy` raises errors on all migrations when used with https://mypy.readthedocs.io/en/stable/config_file.html#confval-disallow_untyped_defs
So, there are several options:
1. Remove this flag for `[mypy-db.alembic.*]` in `mypy.ini`. This is not a very good idea, because custom code that might get written in this directory might be not fully typed.
2. Edit our own template. This is what we end up doing right now, but this requires some manual work and many users might miss it
3. Update the source! I think that this is harmless (because only python3.6+ is supported), but allows better type-checking
### Checklist
Openning this as a draft for now. Will fix tests after I can see what is failing in the CI.
Issue is also on its way! 🙂
<!-- 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
- [ ] 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.
- [x] 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.
Fixes https://github.com/sqlalchemy/alembic/issues/764
**Have a nice day!**
Closes: #1012
Pull-request: https://github.com/sqlalchemy/alembic/pull/1012
Pull-request-sha: c1d17b202f414a97e6215cc2a513509462a9db09
Change-Id: Ib077157b5ebd697bf648644a954ed5a9a3b33080
|
|
|
|
|
| |
Change-Id: I30257b346c3e3b518d63a80e495d354103063fa9
Fixes: #1020
|
|
|
|
|
|
|
|
|
| |
both black and click were released in the past
few hours, and black 21.5b1 seems to suddenly
be failing on a missing symbol from click. just
update to the latest
Change-Id: Icb9d98d6473aa603aa29ad1c2d1e43ff3b371db5
|
|
|
|
|
|
|
|
|
|
|
|
| |
In response to #1006, add tests for covering indexes
for PostgreSQL and MSSQL.
Refactor test_autogen_indexes to be generalized for all
backends. Parts of this test module should eventually move
to the suite tests.
Fixes: #1006
Change-Id: I126b0bcbf4f065e5b148567929fece898e66821e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed issue where using :meth:`.Operations.create_table` in conjunction
with a :class:`.CheckConstraint` that referred to table-bound
:class:`.Column` objects rather than string expressions would be added to
the parent table twice, resulting in an incorrect DDL sequence. Pull
request courtesy Nicolas CANIART.
Fixes: #1004
Closes: #1005
Pull-request: https://github.com/sqlalchemy/alembic/pull/1005
Pull-request-sha: 2fe5c5297bcde990096571a047039c451aa876f6
Change-Id: I2bf48701968fe59a6766f8f8879320b1bfd75774
|
|
|
|
| |
Change-Id: Iec2b2ae9c2df9592988fa2239b768d1919eec297
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I6d2662cb5c13d5438210aa001cbdb8c7eb876bb7
|
|
|
|
| |
Change-Id: I3180931673496260614e69e95f7da09d68b51714
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
| |
Adjustments to the test suite to accommodate for error message changes
occurring as of SQLAlchemy 1.4.27.
Change-Id: I5092c8d3ba3d16819b200f1dfc3c30b8d24abe30
|
|
|
|
|
|
|
| |
SQLAlchemy added FK onupdate/ondelete reflection
in 1.4.26
Change-Id: Ie4e95294fe3857ea1f28a67a7a78ca9213e8e8f8
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
| |
Adjust require of importlib_metadata also include py3.8.
Fixes: #934
Change-Id: Id64163a0dc53226d62795d40190b6cec0aee522b
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| | |
Change-Id: I05dae157320be49eb598084388196e72896bc89d
Fixes: #880
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| | |
Change-Id: I76654f10e208d618e21ab0c884cb0abede4d6177
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|