-
Notifications
You must be signed in to change notification settings - Fork 63
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
Patch references to UC schemas to capture dependencies automatically #1989
base: main
Are you sure you want to change the base?
Conversation
Test Details: go/deco-tests/12239986056 |
${resources.schemas...}
syntax
diags := diag.Diagnostics{} | ||
for k, p := range rb.Config().Resources.Pipelines { | ||
// Skip if the pipeline uses hive metastore. | ||
if p.Catalog == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API allows creating a pipeline without a schema/target specified as long as you are not using UC. It's not a forward-looking use case anyway, so I did not look deeper into this.
Severity: diag.Warning, | ||
Summary: `Use ${resources.schemas.s1.name} syntax to refer to the UC schema instead of directly using its name "schema1"`, | ||
Detail: `Using ${resources.schemas.s1.name} will allow DABs to capture the deploy time dependency this DLT pipeline | ||
has on the schema "schema1" and deploy changes to the schema before deploying the pipeline.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be painful to update this test if the message changes, but it's not nice to assert on the message.
I have added a "golden files" test utilities here #2025 , it's a good fit for this cases.
Full output is stored in the file and can be updated by running tests with TESTS_OUTPUT=OVERWRITE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, that PR only targets integration tests for now, so not ready for your use case yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine in this case since its unit tests that are colocated with the mutator that implements the functionality. It'll be a simple search and replace when updating.
Are you proposing to extend the golden file approach to mutators or unit tests? Possibly by serializing the diagnostics and persisting them in a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we can ask users to capture this dependency through variable interpolation, but could we do this ourselves instead? I.e. we know if someone wants to use a schema for a volume, so we can inject a "depends on" relationship transparently.
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
${resources.schemas...}
syntaxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Few suggestions.
"nilschema": {}, | ||
"emptyschema": { | ||
CreateSchema: &catalog.CreateSchema{}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nilschema
should be nil
as in actual nil
and empty as in what's now the nilschema
.
Changes
FIxes #1977.
Tests
Unit tests and manually.