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

fix: alembic migration error msg trying to delete constraint on tables #11115

Merged
merged 4 commits into from
Oct 1, 2020

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Sep 30, 2020

SUMMARY

Alembic migration error msg on PG:

INFO  [alembic.runtime.migration] Running upgrade e5ef6828ac4e -> 18532d70ab98, Delete table_name unique constraint in mysql
(psycopg2.errors.UndefinedObject) constraint "table_name" of relation "tables" does not exist
[SQL: ALTER TABLE tables DROP CONSTRAINT table_name]

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@dpgaspar dpgaspar changed the title fix: alembic migration fails by deleting constraint on tables fix: alembic migration error msg trying to delete constraint on tables Sep 30, 2020
@pull-request-size pull-request-size bot added size/S and removed size/M labels Sep 30, 2020
@dpgaspar dpgaspar added the risk:db-migration PRs that require a DB migration label Sep 30, 2020
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think this migration shows that we could do with some migration squashing for Superset 1.0, as there's obviously some divergence even between Postgres and MySQL.

@dpgaspar
Copy link
Member Author

LGTM. I think this migration shows that we could do with some migration squashing for Superset 1.0, as there's obviously some divergence even between Postgres and MySQL.

Totally!

if isinstance(bind.dialect, MySQLDialect):
# index only exists in mysql db
with op.get_context().autocommit_block():
op.add_constraint("table_name", "tables", type_="unique")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError: module 'alembic.op' has no attribute 'add_constraint'

I would say - let's pass on the downgrade. That constraint was never needed

Copy link
Member

@bkyryliuk bkyryliuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG%nit

@pull-request-size pull-request-size bot added size/XS and removed size/S labels Oct 1, 2020
@dpgaspar dpgaspar merged commit 50d8040 into apache:master Oct 1, 2020
@dpgaspar dpgaspar deleted the fix/table_mig branch October 1, 2020 11:35
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
apache#11115)

* fix: alembic migration fails by deleting non existent constraint on tables

* Revert "fix: alembic migration fails by deleting non existent constraint on tables"

This reverts commit 3a359b0.

* mantain migration but just for MySQL and add downgrade procedure

* skip the downgrade
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels risk:db-migration PRs that require a DB migration size/XS 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants