Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: support generated columns #137

Copy link
Copy link
Closed
@skuruppu

Description

@skuruppu
Issue body actions

Is your feature request related to a problem? Please describe.
I was trying to setup the following table:

singers = Table(
    "Singers",
    metadata,
    Column("SingerId", String(36), primary_key=True, nullable=False),
    Column("FirstName", String(200)),
    Column("LastName", String(200), nullable=False),
    Column("FullName", String(400), nullable=False, Computed("COALESCE(FirstName || ' ', '') || LastName")
)

and I got this error from the Spanner backend:

google.api_core.exceptions.InvalidArgument: 400 Error parsing Spanner DDL statement: CREATE TABLE `Singers` (\n\t`SingerId` STRING(36) NOT NULL, \n\t`FirstName` STRING(200), \n\t`LastName` STRING(200) NOT NULL, \n\t`FullName` STRING(400) GENERATED ALWAYS AS (COALESCE(FirstName || \' \', \'\') || LastName) NOT NULL\n) PRIMARY KEY (SingerId) : Syntax error on line 5, column 25: Expecting \')\' but found \'GENERATED\'

This happens because SQLAlchemy translates Generated("<computation>") to GENERATED ALWAYS AS (<computation>) STORED. But Spanner syntax for generated colums is AS (<computation>) STORED.

Describe the solution you'd like
Support generated columns as Spanner expects it.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.