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

Index postgresql_include renders the columns incorrectly #1258

Open
CaselIT opened this issue Jun 8, 2023 · 0 comments
Open

Index postgresql_include renders the columns incorrectly #1258

CaselIT opened this issue Jun 8, 2023 · 0 comments
Labels

Comments

@CaselIT
Copy link
Member

CaselIT commented Jun 8, 2023

Describe the bug
Trying to add an index like

    sa.Index(
        "my_index",
        my_table.c.a_column,
        postgresql_include=[my_table.c.b_column],
    )

generates a migration that's not valid python, both on the upgrade and downgrade. Downgrade renders:

# upgrade
op.create_index('my_index', 'my_table', ['a_column'], unique=False, postgresql_include=[Column('b_column', Text(), table=<my_table>)])
# downgrage
op.drop_index('my_index', table_name='my_table', postgresql_include=[Column('b_column', Text(), table=<my_table>)])

Expected behavior
The postgresql_include renders correctly

To Reproduce
Please try to provide a Minimal, Complete, and Verifiable example, with the migration script and/or the SQLAlchemy tables or models involved.
See also Reporting Bugs on the website.

import sqlalchemy as sa

my_table = sa.Table('my_table', sa.MetaData(), Column('a_column', Text()), Column('b_column', Text()))
sa.Index("my_index", my_table.c.a_column, postgresql_include=[my_table.c.b_column])

Error

See above

Versions.

  • OS: any
  • Python: any
  • Alembic: 1.10+
  • SQLAlchemy: any
  • Database: postgresql
  • DBAPI: any

Additional context

Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant