Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,9 @@ def get_indexes(self, connection, table_name, schema=None, **kw):
WHERE
i.table_name="{table_name}"
AND i.index_type != 'PRIMARY_KEY'
AND i.spanner_is_managed = FALSE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't show automatic indexes ruled by Spanner under the hood

GROUP BY i.index_name, i.is_unique
ORDER BY i.index_name
""".format(
table_name=table_name
)
Expand Down
7 changes: 7 additions & 0 deletions test/test_suite_13.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,13 @@ def test_array_reflection(self):

tab.drop()

def _assert_insp_indexes(self, indexes, expected_indexes):
expected_indexes.sort(key=lambda item: item["name"])

index_names = [d["name"] for d in indexes]
exp_index_names = [d["name"] for d in expected_indexes]
assert sorted(index_names) == sorted(exp_index_names)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overriding the test to check indexes in ordered fashion



class CompositeKeyReflectionTest(_CompositeKeyReflectionTest):
@testing.requires.foreign_key_constraint_reflection
Expand Down
7 changes: 7 additions & 0 deletions test/test_suite_14.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,13 @@ def test_get_temp_table_unique_constraints(self):
def test_get_temp_table_columns(self):
pass

def _assert_insp_indexes(self, indexes, expected_indexes):
expected_indexes.sort(key=lambda item: item["name"])

index_names = [d["name"] for d in indexes]
exp_index_names = [d["name"] for d in expected_indexes]
assert sorted(index_names) == sorted(exp_index_names)


class CompositeKeyReflectionTest(_CompositeKeyReflectionTest):
@testing.requires.foreign_key_constraint_reflection
Expand Down