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

ADAP-389: Stub materialized view as a materialization #387

Merged

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Mar 29, 2023

resolves dbt-labs/dbt-core#6911

Description

Stub out the materialized view materialization for Redshift. Under the hood this just creates a view for now. But this can be used to verify all of the plumbing.

While creating the materialization, it was observed that other materialization templates existed outside of the materialization directory. These were moved from adapters.sql into the materialization directory in the appropriate file (e.g. table.sql). Some of the macros were also refactored to be smaller bits of code and dbt-postgres dependencies were eliminated when found.

Checklist

@cla-bot cla-bot bot added the cla:yes label Mar 29, 2023
@github-actions
Copy link
Contributor

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 dbt-redshift contributing guide.

@mikealfare mikealfare added the Skip Changelog Skips GHA to check for changelog file label Mar 29, 2023
@mikealfare
Copy link
Contributor Author

I'm skipping the change log on this; it's too granular. There will be a changelog at the feature level that will be merged into main.

@mikealfare mikealfare self-assigned this Mar 29, 2023
@mikealfare mikealfare changed the title Feature/materialized views/adap 389 ADAP-389: Stub materialized view as a materialization Mar 29, 2023
@mikealfare
Copy link
Contributor Author

I'm running into an issue while trying to recreate materialized views. They don't appear to show up as expected in pg_depend. When a materialized view is created, call it my_mat_view, based on a table called my_table, Redshift actually creates a view called my_mat_view and a table called tbl_mv__my_mat_view__0. The entries that show up in pg_depend tie my_mat_view to tbl_mv__my_mat_view__0, which is technically correct. Unfortunately, my_table does not show up at all even though that is the actual dependency from the user's perspective. I believe when we recreate the materialized view, we are inadvertently dropping it because the dependency is not properly managed when recreating the table.

@mikealfare mikealfare marked this pull request as ready for review June 16, 2023 03:39
@mikealfare mikealfare requested a review from a team as a code owner June 16, 2023 03:39
@mikealfare mikealfare removed the request for review from colin-rogers-dbt June 16, 2023 04:38
@mikealfare mikealfare merged commit fc76f4a into feature/materialized-views/ADAP-2 Jun 16, 2023
@mikealfare mikealfare deleted the feature/materialized-views/ADAP-389 branch June 16, 2023 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2068] [Feature] Let's add Materialized View as a materialization, finally
2 participants