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

Duplicate Datasources #410

Merged
merged 6 commits into from
Dec 12, 2023
Merged

Duplicate Datasources #410

merged 6 commits into from
Dec 12, 2023

Conversation

dehume
Copy link
Contributor

@dehume dehume commented Dec 12, 2023

Fixes #408

Investigation for duplicate datasources. It seems that the issue was with materialize_materialized_views that contained a top level comment as well as column level comments. This cannot be set via the provider (mostly likely dbt) which was leading to duplicated rows in the data sources. Including AND object_sub_id IS NULL to the subquery removes the column level comments.

Also including acceptance tests for all data sources:

Datasource Status
cluster replica X
cluster X
connection X
current cluster X
current database X
database X
egress ip X
index X
materialized view X
role X
schema X
secret X
sink X
source X
table X
type X
view X

@@ -26,7 +26,7 @@ func TestTransformIdWithRegion(t *testing.T) {
"expected": "aws/us-east-1:u1",
},
}
for tc, _ := range testCases {
for tc := range testCases {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated, just from running format

Copy link
Contributor

@bobbyiliev bobbyiliev left a comment

Choose a reason for hiding this comment

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

Seems like that the IDs migration CI is failing, but it should no longer be needed as the version has now been released.

@dehume dehume changed the title [WIP] Duplicate Datasources Duplicate Datasources Dec 12, 2023
@dehume dehume marked this pull request as ready for review December 12, 2023 19:04
@@ -2,6 +2,12 @@

## Unreleased

### Features
* Allow Avro comments (`avro_doc_type` and `avro_doc_column`) for resource `materialize_sink_kafka` [#373](https://github.com/MaterializeInc/terraform-provider-materialize/pull/373)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was not included in the last PR

@@ -114,6 +114,7 @@ var materializedViewQuery = NewBaseQuery(`
SELECT id, comment
FROM mz_internal.mz_comments
WHERE object_type = 'materialized-view'
AND object_sub_id IS NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual fix for the duplication issue. The majority of the PR is just testing

@dehume dehume requested a review from bobbyiliev December 12, 2023 20:02
Copy link
Contributor

@bobbyiliev bobbyiliev left a comment

Choose a reason for hiding this comment

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

This is great! Thank you for adding all of those tests!

@dehume dehume merged commit ce08982 into main Dec 12, 2023
6 checks passed
@dehume dehume deleted the Duplicate-Datasources branch December 12, 2023 20:07
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.

Datasource Duplicates materialize_materialize_views
2 participants