Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

feat: support generated columns #137

Closed

Description

@skuruppu

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.

Activity

  1. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    priority: p3Desirable enhancement or fix. May not be included in next release.
    on Nov 3, 2021
  2. added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    and removed
    priority: p3Desirable enhancement or fix. May not be included in next release.
    on Nov 3, 2021
  3. added a commit that references this issue on Nov 19, 2021
    046ca97
  4. added a commit that references this issue on Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.priority: p1Important 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.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions