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

Support CREATE OR REPLACE in table materialization #377

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

damian3031
Copy link
Member

resolves #371

Support CREATE OR REPLACE in table materialization.
Other materializations will be handled in separate PRs.

New behaviour is enabled by adding on_table_exists='replace' config.

Copy link

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link
Member

@hovaesco hovaesco left a comment

Choose a reason for hiding this comment

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

Looks good, this would require docs update.

check_relations_equal(project.adapter, ["seed", "materialization"])


@pytest.mark.iceberg
Copy link
Member

Choose a reason for hiding this comment

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

delta not supported yet?

cc @findinpath

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAIK it is currently supported only on iceberg
trinodb/trino#13180 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

delta not supported yet?

CREATE OR REPLACE for Delta will be supported as of this week in Galaxy.

OSS see trinodb/trino#19991

Copy link
Collaborator

Choose a reason for hiding this comment

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

CREATE OR REPLACE is live on Galaxy and can be used for testing both Iceberg & Delta Lake tables.

@damian3031
Copy link
Member Author

Latest versions of SEP and Galaxy don't support CREATE OR REPLACE yet (that's why it failed in CI). Therefore, we probably need to wait for this support before merging this PR.

@wrb2
Copy link

wrb2 commented Dec 3, 2023

It's a bit confusing, but

  1. Trino does support it for Iceberg but not for Delta Lake.
  2. SEP does support it for Delta Lake but not for Iceberg.
  3. Galaxy documentation is silent on this topic, so I guess it does not support it?

@wrb2
Copy link

wrb2 commented Dec 15, 2023

I'm just wondering, does the create or replace drops old data or does the table need vacuum eventually? It has to keep it around at least for a while, otherwise it would break readers.

If it needs vacuum, it might be worth documenting recommendation to run it in a posthook or something, so that the created or replaced tables don't grow out of bounds.

(Unless Trino runs vacuum by itself sometimes.)

tests/conftest.py Dismissed Show dismissed Hide dismissed
@damian3031 damian3031 merged commit 6f786fa into master Dec 20, 2023
10 of 11 checks passed
@damian3031 damian3031 deleted the support-create-or-replace branch December 20, 2023 12:27
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.

Support CREATE OR REPLACE
5 participants