fix: raise Unimplemented error when creating temporary tables by IlyaFaer · Pull Request #159 · googleapis/python-spanner-sqlalchemy · GitHub
Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
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: 1 addition & 1 deletion README.md
2 changes: 1 addition & 1 deletion google/cloud/sqlalchemy_spanner/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

@temp_table_keyword_args.for_db("spanner")
def _spanner_temp_table_keyword_args(cfg, eng):
return {}
return {"prefixes": ["TEMPORARY"]}
5 changes: 5 additions & 0 deletions google/cloud/sqlalchemy_spanner/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def isolation_level(self):
def sequences(self):
return exclusions.closed()

@property
def temporary_tables(self):
"""Target database supports temporary tables."""
return exclusions.closed()
Comment thread
IlyaFaer marked this conversation as resolved.

def get_order_by_collation(self, _):
"""Get the default collation name.

Expand Down
3 changes: 3 additions & 0 deletions google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ def post_create_table(self, table):
cols = [col.name for col in table.primary_key.columns]
post_cmds = " PRIMARY KEY ({})".format(", ".join(cols))

if "TEMPORARY" in table._prefixes:
raise NotImplementedError("Temporary tables are not supported.")

if table.kwargs.get("spanner_interleave_in"):
post_cmds += ",\nINTERLEAVE IN PARENT {}".format(
table.kwargs["spanner_interleave_in"]
Expand Down
3 changes: 0 additions & 3 deletions test/test_suite.py