Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rkawajiri opened this issue Oct 19, 2023 · 1 comment
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@rkawajiri
Copy link

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"
@rkawajiri rkawajiri added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 19, 2023
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Oct 19, 2023
@rkawajiri rkawajiri changed the title sqlalchemy.schema.DropTable compilation: Table name should be quoted by ` on DROP sqlalchemy.schema.DropTable compilation: Table name should be quoted by back quotes (`) on DROP Oct 19, 2023
@rkawajiri rkawajiri changed the title sqlalchemy.schema.DropTable compilation: Table name should be quoted by back quotes (`) on DROP sqlalchemy.schema.DropTable compilation: Table name should be quoted by back quotes (`) on DROP TABLE Oct 19, 2023
@harshachinta harshachinta assigned ankiaga and unassigned harshachinta Dec 26, 2023
@ankiaga
Copy link
Contributor

ankiaga commented Feb 5, 2024

PR raised #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants