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

Migration autogeneration should respect schemas defined using quoted_name #1526

Open
characat0 opened this issue Aug 30, 2024 · 0 comments
Open
Labels
autogenerate - rendering bug Something isn't working

Comments

@characat0
Copy link

characat0 commented Aug 30, 2024

Describe the bug
When defining a table, schemas defined using quoted_name should be present on the migration generated code.

Expected behavior
The schema present in the migration file should be defined using quoted_name too

To Reproduce
Define a class using the snipped provided, then run alembic revision --autogenerate and check the generated migration operations

from sqlalchemy.orm import DeclarativeBase
from sqlalchemy import quoted_name

class Base(DeclarativeBase):
    pass

class Example(Base):
    __table_args__ = {'schema': quoted_name('database.schema', quote=False)}
    example_field = Column(Integer, primary_key=True)

Actual behaviour

    op.create_table('example',
    sa.Column('example_field', sa.Integer()),
    sa.PrimaryKeyConstraint('account_id'),
    schema='database.schema'
    )

Expected behaviour

    op.create_table('example',
    sa.Column('example_field', sa.Integer()),
    sa.PrimaryKeyConstraint('account_id'),
    schema=quoted_name('database.schema', quote=False)
    )

Versions.

  • OS: Mac
  • Python:3.12
  • Alembic: 1.13.2
  • SQLAlchemy: 2.0.32
  • Database: Databricks

Additional context
Im using the databricks sql connector 3.3.0

Have a nice day!

@characat0 characat0 added the requires triage New issue that requires categorization label Aug 30, 2024
@zzzeek zzzeek added autogenerate - rendering bug Something isn't working and removed requires triage New issue that requires categorization labels Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autogenerate - rendering bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants