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

missing check for batch mode in render for create_foreign_key. #315

Closed
sqlalchemy-bot opened this Issue Aug 12, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@sqlalchemy-bot

sqlalchemy-bot commented Aug 12, 2015

Migrated issue, originally created by Ryan Lahfa (@OzVessalius)

In batch mode (for SQLite support), autogeneration doesn't work as expected with Foreign Key generation for example.

Look at autogenerate/render.py:245 function, it should add create_foreign_key calls.
The arguments provided are one for the operation.create_foreign_key call.
If we are in batch mode, we MUST omit the source table as it is redundant.

Then, the auto-generated call isn't valid at the end.

A quick workaround would be to patch the code and check for batch_prefix in autogen_context.
If we found it, we would pop the useless arguments and I think that should do it.

If you need more information about that, please, let me know! :)
Thanks for Alembic!

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

Michael Bayer (@zzzeek) wrote:

Thanks for reporting. please refer to the current master when reporting issues. All the render functions except for create_foreign_key are consulting the batch context and the test itself is also testing for the wrong call in test_autogen_composition.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

Changes by Michael Bayer (@zzzeek):

  • removed labels: easy
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

Changes by Michael Bayer (@zzzeek):

  • changed title from "Autogenerate in batch mode doesn't generate good f" to "missing check for batch mode in render for create_"
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

Changes by Michael Bayer (@zzzeek):

  • set milestone to "fasttrack"
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

Michael Bayer (@zzzeek) wrote:

  • Fixed bug in batch mode where the batch_op.create_foreign_key()
    directive would be incorrectly rendered with the source table and
    schema names in the argument list.
    fixes #315

1458041

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Aug 12, 2015

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