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

autogen createindex has column objects, but then this crashes when trying to do to_index() #803

Closed
zzzeek opened this issue Feb 25, 2021 · 2 comments
Labels
autogenerate - rendering bug Something isn't working
Milestone

Comments

@zzzeek
Copy link
Member

zzzeek commented Feb 25, 2021

    @writer.rewrites(ops.CreateIndexOp)
    def create_index(context, revision, op):
        return [ops.CreateIndexOp(
            op.index_name,
            op.table_name,
            op.columns,
            schema=op.schema,
            unique=op.unique,
            postgresql_concurrently=True
        )]

leads to:

File "/home/classic/dev/alembic/alembic/autogenerate/render.py", line 88, in render_op
    lines = util.to_list(renderer(autogen_context, op))
  File "/home/classic/dev/alembic/alembic/autogenerate/render.py", line 115, in _render_modify_table
    t_lines = render_op(autogen_context, t_op)
  File "/home/classic/dev/alembic/alembic/autogenerate/render.py", line 88, in render_op
    lines = util.to_list(renderer(autogen_context, op))
  File "/home/classic/dev/alembic/alembic/autogenerate/render.py", line 229, in _add_index
    index = op.to_index()
  File "/home/classic/dev/alembic/alembic/operations/ops.py", line 808, in to_index
    idx = schema_obj.index(
  File "/home/classic/dev/alembic/alembic/operations/schemaobj.py", line 157, in index
    *[util.sqla_compat._textual_index_column(t, n) for n in columns],
  File "/home/classic/dev/alembic/alembic/operations/schemaobj.py", line 157, in <listcomp>
    *[util.sqla_compat._textual_index_column(t, n) for n in columns],
  File "/home/classic/dev/alembic/alembic/util/sqla_compat.py", line 256, in _textual_index_column
    raise ValueError("String or text() construct expected")

one side or the other has to be fixed, not sure what that's about.

@zzzeek zzzeek added bug Something isn't working autogenerate - rendering labels Feb 25, 2021
@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the master branch:

Create schema objects fresh from ops https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/2608

@zzzeek zzzeek added this to the 1.6 milestone Feb 27, 2021
@zzzeek
Copy link
Member Author

zzzeek commented Feb 27, 2021

this is huge and has some implications so let's start 1.6

sqlalchemy-bot pushed a commit that referenced this issue Apr 17, 2021
The change for #803 as well as the upcoming fix for
issue #765 are major changes to the internals, so we will be
on a new minor version.

Change-Id: I6c384c4900761d9b4fb27742a4c8ecb227aa87e3
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