Skip to content

[WiP] Introduce uuids to power ImportExportMixin#7829

Closed
mistercrunch wants to merge 2 commits into
apache:masterfrom
mistercrunch:uuids
Closed

[WiP] Introduce uuids to power ImportExportMixin#7829
mistercrunch wants to merge 2 commits into
apache:masterfrom
mistercrunch:uuids

Conversation

@mistercrunch
Copy link
Copy Markdown
Member

WIP!

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

Comment thread superset/utils/sqla.py


def get_uuid():
return str(uuid.uuid4())
Copy link
Copy Markdown
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
Copy Markdown

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