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

Unable to compare custom with different data type based on dialect #296

Closed
sqlalchemy-bot opened this issue Apr 30, 2015 · 6 comments
Closed
Labels
bug

Comments

@sqlalchemy-bot
Copy link

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Migrated issue, originally created by Julien Danjou

When using alembic.autogenerate.compare_metadata(), if custom types are used whose implementations differs based on dialect, the comparator generates wrong changes.

For example, when using UUIDType from https://sqlalchemy-utils.readthedocs.org/en/latest/_modules/sqlalchemy_utils/types/uuid.html#UUIDType, the comparator sees this change:

     [ ( 'modify_type',
          None,
          'volume',
          'id',
          { 'existing_nullable': False,
            'existing_server_default': None},
          CHAR(length=32),
          UUIDType(length=16))]]
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Michael Bayer (@zzzeek) wrote:

  • Added support for type comparison functions to be not just per
    environment, but also present on the custom types themselves, by
    supplying a method compare_against_backend.
    Added a new documentation section :ref:compare_types describing
    type comparison fully.
    fixes #296

dabc7f0

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Michael Bayer (@zzzeek) wrote:

thanks for reporting. Note that there is already a publicly documented system of augmenting the type comparison system with your own function, at http://alembic.readthedocs.org/en/latest/api.html#alembic.environment.EnvironmentContext.configure.params.compare_type. However, as this is inconvenient for third party types, support for the compare_against_backend method is also added, as well as a new documentation section.

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Julien Danjou wrote:

Thanks Mike! 👍

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Apr 30, 2015

Michael Bayer (@zzzeek) wrote:

here's the new section: http://alembic.readthedocs.org/en/latest/autogenerate.html#compare-types. If you can QA the text and the feature itself that would be very helpful

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented May 4, 2015

Julien Danjou wrote:

This solves my problem! I just sent you a little typo fix in https://bitbucket.org/zzzeek/alembic/pull-request/44/fix-typo-in-autogenerate-documentation/diff
Thanks again!

@sqlalchemy-bot sqlalchemy-bot added the bug label Nov 27, 2018
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