Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sqlalchemy.schema.DropTable compilation: Table name should be quoted by back quotes (`) on DROP TABLE #349

@rkawajiri

Description

@rkawajiri

Environment details

  • Programming language: python
  • OS: debian (official docker image python:3.11-bullseye)
  • Language runtime version: python 3.11.6
  • Package version:
    • sqlalchemy-spanner==1.6.2
    • sqlalchemy==2.0.22

Steps to reproduce

Execute this code.

from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped
from google.cloud.sqlalchemy_spanner import SpannerDialect

class Base(DeclarativeBase):
    pass

class User(Base):
    __tablename__ = 'Users'

    id: Mapped[int] = mapped_column(primary_key=True)

print(CreateTable(User.__table__).compile(dialect=SpannerDialect()).string)
print(DropTable(User.__table__).compile(dialect=SpannerDialect()).string)

then it will print

CREATE TABLE `Users` (
	id INT64 NOT NULL
) PRIMARY KEY (id)

DROP TABLE "Users"

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions