-
Couldn't load subscription status.
- Fork 188
REOPEN: [#1466] Filter intersection of tags #1968
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,15 @@ const tagsOption: INamedOption<yargs.Options> = { | |
| } | ||
| }; | ||
|
|
||
| const flterTagsAsIntersectionSelectorOption: INamedOption<yargs.Options> = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in the word "filter" |
||
| name: "filter-tags-as-intersection", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make it shorter for the user. Maybe just |
||
| option: { | ||
| describe: "If set, only actions that include every user-specified tags will be run", | ||
| type: "boolean", | ||
| default: false | ||
| } | ||
| } | ||
|
|
||
| const includeDepsOption: INamedOption<yargs.Options> = { | ||
| name: "include-deps", | ||
| option: { | ||
|
|
@@ -469,6 +478,7 @@ export function runCli() { | |
| credentialsOption, | ||
| fullRefreshOption, | ||
| includeDepsOption, | ||
| flterTagsAsIntersectionSelectorOption, | ||
| includeDependentsOption, | ||
| credentialsOption, | ||
| jsonOutputOption, | ||
|
|
@@ -511,7 +521,9 @@ export function runCli() { | |
| actions: argv[actionsOption.name], | ||
| includeDependencies: argv[includeDepsOption.name], | ||
| includeDependents: argv[includeDependentsOption.name], | ||
| tags: argv[tagsOption.name] | ||
| tags: argv[tagsOption.name], | ||
| flterTagsAsIntersectionSelector: argv[flterTagsAsIntersectionSelectorOption.name] | ||
|
|
||
| }, | ||
| dbadapter | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,6 +287,11 @@ suite("@dataform/api", () => { | |
| target: { schema: "schema", name: "op_d" }, | ||
| tags: ["tag3"], | ||
| queries: ["create or replace view schema.someview as select 1 as test"] | ||
| }, | ||
| { | ||
| target: { schema: "schema", name: "op_e" }, | ||
| tags: ["tag1", "tag2"], | ||
| queries: ["create or replace view schema.someview as select 1 as test"] | ||
| } | ||
| ], | ||
| tables: [ | ||
|
|
@@ -362,6 +367,22 @@ suite("@dataform/api", () => { | |
| expect(actionNames).includes("schema.tab_a"); | ||
| }); | ||
|
|
||
| test("prune actions with --tags (with include all tags)", () => { | ||
| const prunedGraph = prune(TEST_GRAPH_WITH_TAGS, { | ||
| tags: ["tag1", "tag2"], | ||
| includeAllTags: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. filterTagsAsIntersection? |
||
| }); | ||
| const actionNames = [ | ||
| ...prunedGraph.tables.map(action => targetAsReadableString(action.target)), | ||
| ...prunedGraph.operations.map(action => targetAsReadableString(action.target)) | ||
| ]; | ||
| expect(actionNames).deep.equals(["schema.op_e", "schema.op_a"]); | ||
| expect(actionNames).not.includes("schema.op_a"); | ||
| expect(actionNames).not.includes("schema.op_b"); | ||
| expect(actionNames).not.includes("schema.op_c"); | ||
| expect(actionNames).not.includes("schema.op_d"); | ||
|
Comment on lines
+380
to
+383
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already made a |
||
| }); | ||
|
|
||
| test("prune actions with --actions with dependencies", () => { | ||
| const prunedGraph = prune(TEST_GRAPH, { actions: ["schema.a"], includeDependencies: true }); | ||
| const actionNames = [ | ||
|
|
||
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.
Instead of
runConfig.filterTagsAsIntersection?.valueOf()I suggest to use!!runConfig.filterTagsAsIntersectionThere is also a typo in the word
Filter.