summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_reflection.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/postgresql/test_reflection.py')
-rw-r--r--test/dialect/postgresql/test_reflection.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py
index ea72d5710..6e7d7202a 100644
--- a/test/dialect/postgresql/test_reflection.py
+++ b/test/dialect/postgresql/test_reflection.py
@@ -111,6 +111,7 @@ class PartitionedReflectionTest(fixtures.TablesTest, AssertsExecutionResults):
metadata,
Column("modulus", Integer, nullable=False),
Column("data", String(30)),
+ Column("q", Integer),
postgresql_partition_by="range(modulus)",
)
@@ -124,6 +125,9 @@ class PartitionedReflectionTest(fixtures.TablesTest, AssertsExecutionResults):
),
)
+ if testing.against("postgresql >= 11"):
+ Index("my_index", dv.c.q)
+
def test_get_tablenames(self):
assert {"data_values", "data_values_4_10"}.issubset(
inspect(testing.db).get_table_names()
@@ -131,11 +135,25 @@ class PartitionedReflectionTest(fixtures.TablesTest, AssertsExecutionResults):
def test_reflect_cols(self):
cols = inspect(testing.db).get_columns("data_values")
- eq_([c["name"] for c in cols], ["modulus", "data"])
+ eq_([c["name"] for c in cols], ["modulus", "data", "q"])
def test_reflect_cols_from_partition(self):
cols = inspect(testing.db).get_columns("data_values_4_10")
- eq_([c["name"] for c in cols], ["modulus", "data"])
+ eq_([c["name"] for c in cols], ["modulus", "data", "q"])
+
+ @testing.only_on("postgresql >= 11")
+ def test_reflect_index(self):
+ idx = inspect(testing.db).get_indexes("data_values")
+ eq_(
+ idx, [{"column_names": ["q"], "name": "my_index", "unique": False}]
+ )
+
+ @testing.only_on("postgresql >= 11")
+ def test_reflect_index_from_partition(self):
+ idx = inspect(testing.db).get_indexes("data_values_4_10")
+ # note the name appears to be generated by PG, currently
+ # 'data_values_4_10_q_idx'
+ eq_(idx, [{"column_names": ["q"], "name": mock.ANY, "unique": False}])
class MaterializedViewReflectionTest(