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: remove old constraint #29649

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

betodealmeida
Copy link
Member

SUMMARY

The dataset model has a comment that says:

# Note this uniqueness constraint is not part of the physical schema, i.e., it does
# not exist in the migrations, but is required by `import_from_dict` to ensure the
# correct filters are applied in order to identify uniqueness.
#
# The reason it does not physically exist is MySQL, PostgreSQL, etc. have a
# different interpretation of uniqueness when it comes to NULL which is problematic
# given the schema is optional.
__table_args__ = (
UniqueConstraint("database_id", "catalog", "schema", "table_name"),
)

But turns out there is an old migration from 2016 that adds the uniqueness constraint to the schema:

op.create_unique_constraint(
"_customer_location_uc", "tables", ["database_id", "schema", "table_name"]
)

With the introduction of catalogs in SIP-95 this constraint needs to either be updated to include catalog, or removed to align with the SqlaTable model. In this PR I went with the latter.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@betodealmeida betodealmeida requested a review from a team as a code owner July 19, 2024 20:19
@github-actions github-actions bot added the risk:db-migration PRs that require a DB migration label Jul 19, 2024
@dosubot dosubot bot added the change:backend Requires changing the backend label Jul 19, 2024
@betodealmeida betodealmeida force-pushed the remove-old-constraint branch from 63ca30b to a0fe8af Compare July 19, 2024 20:22
@betodealmeida betodealmeida force-pushed the remove-old-constraint branch from a0fe8af to 9335d7a Compare July 19, 2024 20:57
@mistercrunch
Copy link
Member

Hey, thinking about applying some of the ideas in #29546, which would point towards either accumulating this PR and holding it until next release, or merging this in to a no-op place that we would bring into an actual migration later.

Curious as to whether you all think it's better to hold the PR, or to merge into a temporary place.

@mistercrunch
Copy link
Member

Easiest option here seems like it'd be to add a hold:next-major:migration label (or similar) and defer

@betodealmeida betodealmeida added the v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch label Dec 9, 2024
@betodealmeida
Copy link
Member Author

Tagged this for 5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:backend Requires changing the backend hold:next-major:migration risk:db-migration PRs that require a DB migration size/M v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants