diff options
| author | Gord Thompson <gord@gordthompson.com> | 2021-12-20 14:37:13 -0700 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-12-27 14:32:39 -0500 |
| commit | 5ada58954afa4fa427f4f7a91c683c1210d3d6df (patch) | |
| tree | 983a285274d93bb94d3687fdb502d52470f9197d /lib/sqlalchemy/testing | |
| parent | 2bb6cfc7c9b8f09eaa4efeffc337a1162993979c (diff) | |
| download | sqlalchemy-5ada58954afa4fa427f4f7a91c683c1210d3d6df.tar.gz | |
Reflect included columns as dialect_options
Fixed reflection of covering indexes to report ``include_columns`` as part
of the ``dialect_options`` entry in the reflected index dictionary, thereby
enabling round trips from reflection->create to be complete. Included
columns continue to also be present under the ``include_columns`` key for
backwards compatibility.
Fixes: #7382
Change-Id: I4f16b65caed3a36d405481690a3a92432b5efd62
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index ba176bcd9..9287f76de 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -1232,6 +1232,9 @@ class ComponentReflectionTestExtra(fixtures.TestBase): ] if testing.requires.index_reflects_included_columns.enabled: expected[0]["include_columns"] = [] + expected[0]["dialect_options"] = { + "%s_include" % connection.engine.name: [] + } with expect_warnings( "Skipped unsupported reflection of expression-based index t_idx" @@ -1264,10 +1267,21 @@ class ComponentReflectionTestExtra(fixtures.TestBase): "column_names": ["x"], "include_columns": ["y"], "unique": False, + "dialect_options": { + "%s_include" % connection.engine.name: ["y"] + }, } ], ) + t2 = Table("t", MetaData(), autoload_with=connection) + eq_( + list(t2.indexes)[0].dialect_options[connection.engine.name][ + "include" + ], + ["y"], + ) + def _type_round_trip(self, connection, metadata, *types): t = Table( "t", |
