FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: raise Unimplemented error when creating temporary tables by IlyaFaer · Pull Request #159 · googleapis/python-spanner-sqlalchemy · GitHub

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 .md  (1) .py  (4) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Data types table mapping SQLAlchemy types to Cloud Spanner types:
### Other limitations
- WITH RECURSIVE statement is not supported.
- Named schemas are not supported.
- Temporary tables are not supported, real tables are used instead.
- Temporary tables are not supported.
- Numeric type dimensions (scale and precision) are constant. See the [docs](https://cloud.google.com/spanner/docs/data-types#numeric_types).

## Best practices
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/sqlalchemy_spanner/provision.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from sqlalchemy.testing import provide_metadata, emits_warning
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import is_true
from sqlalchemy.testing.provision import temp_table_keyword_args
from sqlalchemy.testing.schema import Column
from sqlalchemy.testing.schema import Table
from sqlalchemy import literal_column
Expand Down Expand Up @@ -676,7 +675,6 @@ def define_temp_tables(cls, metadata):
creating unique constraints. Overriding the test to replace
constraints with indexes in testing data.
"""
kw = temp_table_keyword_args(config, config.db)
user_tmp = Table(
"user_tmp",
metadata,
Expand All @@ -685,7 +683,6 @@ def define_temp_tables(cls, metadata):
Column("foo", sqlalchemy.INT),
sqlalchemy.Index("user_tmp_uq", "name", unique=True),
sqlalchemy.Index("user_tmp_ix", "foo"),
**kw,
)
if (
testing.requires.view_reflection.enabled
Expand Down

Back | FazBrowse Home | New Git URL