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

[WiP] Introduce uuids to power ImportExportMixin #7829

Closed
wants to merge 2 commits into from

Conversation

mistercrunch
Copy link
Member

WIP!

Exports/imports will work better if we generate and use UUIDs as a basis
for upserting objects.
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.

Great feature 👍 A few quick comments:

"""Add a uuid column to a given table"""
print(f"Add uuid column to table '{tbl_name}'")
with op.batch_alter_table(tbl_name) as batch_op:
batch_op.add_column(Column("uuid", CHAR(36), default=get_uuid))
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest using UUIDType from SQLAlchemy-Utils, as it will automatically leverage native UUID support where available (falls back to BINARY(16) or CHAR(32) where not available). This will introduce a new dependency, but the project is actively maintained, of high quality in my experience, and the license should be ok (BSD).



def get_uuid():
return str(uuid.uuid4())
Copy link
Member

Choose a reason for hiding this comment

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

If we opt to use UUIDType, this shouldn't need to be cast to str (I believe).

@stale
Copy link

stale bot commented Sep 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Sep 7, 2019
@mistercrunch mistercrunch mentioned this pull request Sep 9, 2019
6 tasks
@stale stale bot closed this Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants