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

Problem during upgrade of booleans / CHECK constraints on sqlite batch mode #249

Closed
sqlalchemy-bot opened this issue Nov 27, 2014 · 11 comments
Closed
Milestone

Comments

@sqlalchemy-bot
Copy link

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Migrated issue, originally created by Sven-Hendrik Haase (@svenstaro)

I get the attached stacktrace during upgrade. It fails when I migrate a bool. It works when I migrate a string.


Attachments: 223e903ecdf_.py | lol.log

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Sven-Hendrik Haase (@svenstaro) wrote:

The generated migration

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Changes by Sven-Hendrik Haase (@svenstaro):

  • attached file 223e903ecdf_.py
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Sven-Hendrik Haase (@svenstaro) wrote:

I'm using sqlite for this migration to test them locally.

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Michael Bayer (@zzzeek) wrote:

as the stack trace is local to the all new beta "batch migration" feature I'm assuming this is only with SQLite within batch.

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Changes by Michael Bayer (@zzzeek):

  • removed labels: high priority
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Changes by Michael Bayer (@zzzeek):

  • added labels: batch migrations
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Michael Bayer (@zzzeek) wrote:

a workaround that I think is likely to resolve for now is to render the boolean as follows, without any check constraints:

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('conferences', schema=None) as batch_op:
        batch_op.add_column(sa.Column('ldaadevel', sa.Boolean(create_constraint=False), nullable=True))

    ### end Alembic commands ###

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Changes by Michael Bayer (@zzzeek):

  • changed title from "Problem during upgrade of booleans" to "Problem during upgrade of booleans / CHECK constra"
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 27, 2014

Changes by Michael Bayer (@zzzeek):

  • set milestone to "tier 1"
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 29, 2014

Michael Bayer (@zzzeek) wrote:

  • Repaired the inspection, copying and rendering of CHECK constraints
    and so-called "schema" types such as Boolean, Enum within the batch
    copy system; the CHECK constraint will not be "doubled" when the table is
    copied, and additionally the inspection of the CHECK constraint for
    its member columns will no longer fail with an attribute error.
    fixes #249
  • Added two new arguments
    :paramref:.Operations.batch_alter_table.reflect_args
    and :paramref:.Operations.batch_alter_table.reflect_kwargs, so that
    arguments may be passed directly to suit the
    :class:~.sqlalchemy.schema.Table
    object that will be reflected.

2851811

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Nov 29, 2014

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.