summaryrefslogtreecommitdiff
path: root/test/orm/inheritance/test_poly_loading.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-24 17:04:27 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-02-13 14:23:04 -0500
commite545298e35ea9f126054b337e4b5ba01988b29f7 (patch)
treee64aea159111d5921ff01f08b1c4efb667249dfe /test/orm/inheritance/test_poly_loading.py
parentf1da1623b800cd4de3b71fd1b2ad5ccfde286780 (diff)
downloadsqlalchemy-e545298e35ea9f126054b337e4b5ba01988b29f7.tar.gz
establish mypy / typing approach for v2.0
large patch to get ORM / typing efforts started. this is to support adding new test cases to mypy, support dropping sqlalchemy2-stubs entirely from the test suite, validate major ORM typing reorganization to eliminate the need for the mypy plugin. * New declarative approach which uses annotation introspection, fixes: #7535 * Mapped[] is now at the base of all ORM constructs that find themselves in classes, to support direct typing without plugins * Mypy plugin updated for new typing structures * Mypy test suite broken out into "plugin" tests vs. "plain" tests, and enhanced to better support test structures where we assert that various objects are introspected by the type checker as we expect. as we go forward with typing, we will add new use cases to "plain" where we can assert that types are introspected as we expect. * For typing support, users will be much more exposed to the class names of things. Add these all to "sqlalchemy" import space. * Column(ForeignKey()) no longer needs to be `@declared_attr` if the FK refers to a remote table * composite() attributes mapped to a dataclass no longer need to implement a `__composite_values__()` method * with_variant() accepts multiple dialect names Change-Id: I22797c0be73a8fbbd2d6f5e0c0b7258b17fe145d Fixes: #7535 Fixes: #7551 References: #6810
Diffstat (limited to 'test/orm/inheritance/test_poly_loading.py')
-rw-r--r--test/orm/inheritance/test_poly_loading.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/orm/inheritance/test_poly_loading.py b/test/orm/inheritance/test_poly_loading.py
index 5f8ff5639..d9d4a9a22 100644
--- a/test/orm/inheritance/test_poly_loading.py
+++ b/test/orm/inheritance/test_poly_loading.py
@@ -339,13 +339,13 @@ class TestGeometries(GeometryFixtureBase):
testing.db,
q.all,
CompiledSQL(
- "SELECT a.type AS a_type, a.id AS a_id, "
+ "SELECT a.id AS a_id, a.type AS a_type, "
"a.a_data AS a_a_data FROM a",
{},
),
Or(
CompiledSQL(
- "SELECT a.type AS a_type, c.id AS c_id, a.id AS a_id, "
+ "SELECT c.id AS c_id, a.id AS a_id, a.type AS a_type, "
"c.c_data AS c_c_data, c.e_data AS c_e_data, "
"c.d_data AS c_d_data "
"FROM a JOIN c ON a.id = c.id "
@@ -354,7 +354,7 @@ class TestGeometries(GeometryFixtureBase):
[{"primary_keys": [1, 2]}],
),
CompiledSQL(
- "SELECT a.type AS a_type, c.id AS c_id, a.id AS a_id, "
+ "SELECT c.id AS c_id, a.id AS a_id, a.type AS a_type, "
"c.c_data AS c_c_data, "
"c.d_data AS c_d_data, c.e_data AS c_e_data "
"FROM a JOIN c ON a.id = c.id "
@@ -396,13 +396,13 @@ class TestGeometries(GeometryFixtureBase):
testing.db,
q.all,
CompiledSQL(
- "SELECT a.type AS a_type, a.id AS a_id, "
+ "SELECT a.id AS a_id, a.type AS a_type, "
"a.a_data AS a_a_data FROM a",
{},
),
Or(
CompiledSQL(
- "SELECT a.type AS a_type, c.id AS c_id, a.id AS a_id, "
+ "SELECT a.id AS a_id, a.type AS a_type, c.id AS c_id, "
"c.c_data AS c_c_data, c.e_data AS c_e_data, "
"c.d_data AS c_d_data "
"FROM a JOIN c ON a.id = c.id "
@@ -411,7 +411,7 @@ class TestGeometries(GeometryFixtureBase):
[{"primary_keys": [1, 2]}],
),
CompiledSQL(
- "SELECT a.type AS a_type, c.id AS c_id, a.id AS a_id, "
+ "SELECT c.id AS c_id, a.id AS a_id, a.type AS a_type, "
"c.c_data AS c_c_data, c.d_data AS c_d_data, "
"c.e_data AS c_e_data "
"FROM a JOIN c ON a.id = c.id "
@@ -465,15 +465,15 @@ class TestGeometries(GeometryFixtureBase):
testing.db,
q.all,
CompiledSQL(
- "SELECT a.type AS a_type, a.id AS a_id, "
+ "SELECT a.id AS a_id, a.type AS a_type, "
"a.a_data AS a_a_data FROM a ORDER BY a.id",
{},
),
Or(
# here, the test is that the adaptation of "a" takes place
CompiledSQL(
- "SELECT poly.a_type AS poly_a_type, "
- "poly.c_id AS poly_c_id, "
+ "SELECT poly.c_id AS poly_c_id, "
+ "poly.a_type AS poly_a_type, "
"poly.a_id AS poly_a_id, poly.c_c_data AS poly_c_c_data, "
"poly.e_id AS poly_e_id, poly.e_e_data AS poly_e_e_data, "
"poly.d_id AS poly_d_id, poly.d_d_data AS poly_d_d_data "
@@ -489,9 +489,9 @@ class TestGeometries(GeometryFixtureBase):
[{"primary_keys": [1, 2]}],
),
CompiledSQL(
- "SELECT poly.a_type AS poly_a_type, "
- "poly.c_id AS poly_c_id, "
- "poly.a_id AS poly_a_id, poly.c_c_data AS poly_c_c_data, "
+ "SELECT poly.c_id AS poly_c_id, "
+ "poly.a_id AS poly_a_id, poly.a_type AS poly_a_type, "
+ "poly.c_c_data AS poly_c_c_data, "
"poly.d_id AS poly_d_id, poly.d_d_data AS poly_d_d_data, "
"poly.e_id AS poly_e_id, poly.e_e_data AS poly_e_e_data "
"FROM (SELECT a.id AS a_id, a.type AS a_type, "