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

MMO x DDL #186

Merged
merged 13 commits into from
Oct 29, 2024
Merged

MMO x DDL #186

merged 13 commits into from
Oct 29, 2024

Conversation

robes
Copy link
Contributor

@robes robes commented Oct 23, 2024

Integration of MMO with DDL operations.

robes added 2 commits October 23, 2024 12:29
Package of operations that update 'visible columns' source definitions
found in various annotations based on changes to named model elements.
Col, Key, FKey rename operations propogate name change to annotations.
@@ -1,15 +1,16 @@

from __future__ import annotations

import base64
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... this must be what pycharm meant by "optimizing" imports on commit. I'm gonna not do that in the future. If this is annoying I can revert this part but its just a reordering as far as I see.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's ok

robes added 4 commits October 23, 2024 17:35
Col, Key, FKey drop operations propagate name change to annotations.
Table drop operation propagates name removal to annotations.
Schema drop operation propagates name removal to annotations.
Drop table fix to clean up its implicitly dropped fkeys by pruning their
names from all other table's annotations.
if update_mappings:
for fkey in self.foreign_keys:
mmo.prune(self.schema.model, [fkey.constraint_schema.name, fkey.constraint_name])
self.schema.apply()
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this have to be self.schema.model.apply? Changes could be global across any schema in the model, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks. fixed

robes added 7 commits October 24, 2024 11:26
The absolute imports work better when invoking whole/sub trees of tests.
Fixing the apply() calls to always be rooted on the model not the
current object's parent, since the annotation changes apply potentially
throughout the entire catalog model.
Added a 'deferred' mode and made the 'update_mappings' parameter based
on an enum representing the three modes.

Refactored the pre/post cond logic in the test_mmo_drop unittests as it
seemed over-engineered.
MMO primitives to find, prune, replace constraint names based on the
schema name part only.
Support for updating mappings after a Table.alter(schema_name=...)
change.
Fixed a bug in the bare constraint name case for schema name changes to
be reflected in vizcol and vizfkey annotations.
On `schema.alter(schema_name=...)` all constraint names throughout
supported annotation structures are updated.
Comment on lines 25 to +32
nochange = NoChange()

class UpdateMappings (str, Enum):
"""Update Mappings flag enum"""
no_update = ''
deferred = 'deferred'
immediate = 'immediate'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karlcz think this is okay this way? or would it be better to have variable instances of the enum of say no_update = UpdateMappings.no_update analogous to your nochange = NoChange() instance?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine. You can use it as UpdateMappings.no_update etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

However, I'm not sure I like the empty string... I think I'd also spell it out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, I see you did it to make the "falsish" test easier to write below...

@karlcz
Copy link
Contributor

karlcz commented Oct 29, 2024

I think this is good to merge now. I didn't actually try to run the test suite though, as I'm not sure if/how it depends on the other open PR for mmo...?

@robes
Copy link
Contributor Author

robes commented Oct 29, 2024 via email

@robes robes merged commit bc7c6d8 into master Oct 29, 2024
@robes robes deleted the mmo-x-ddl branch October 29, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants