Skip to content

Alerts filters#498

Merged
IDoneShaveIt merged 19 commits intomasterfrom
alerts-filters
Jan 3, 2023
Merged

Alerts filters#498
IDoneShaveIt merged 19 commits intomasterfrom
alerts-filters

Conversation

@IDoneShaveIt
Copy link
Contributor

Support filtering alerts using --select argument.
In case project dir is provided, we use dbt ls command to filter the nodes.
Otherwise we support manual filtering over tag / owner / model

@github-actions
Copy link
Contributor

👋 @IDoneShaveIt
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

return []
# When nodes are matched, ls command returns strings of the node names.
else:
return command_outputs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it better to also return the JSON-loaded outputs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If nodes are matched, the output of dbt will be:
"node1\nnode2\n"
So I don't see why we should return it like that as well.

When there are no nodes the output is always the same and our warning explains the same thing so it is redundant and will never be used IMO.

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean something else :)
It's good that you split the rows, but I don't get why you call try_load_json and then return the non-json loaded values - why not return the output of try_load_json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I only use try_load_json to understand that I have no nodes matches.
Those json has no additional information, and has no use.
I prefer keeping it all simple and the same typing wise:
If there are matches, return a list of the matches.
If there are no matches, log an error and return an empty list.

There is no value by returning 2 dicts that has message that said that there are no node matches and then parse it outside the function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah OK, I see what you mean
I misunderstood this. Sababa.

"If specified, the target will be used for your dbt project."
"Else, the --profile-target will be used.",
)(func)
func = click.option(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it's critical for now but I wonder if people will expect multiple selectors to work as well.
Can be added to a future version if needed though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that dbt supports only a single selector (when passing more then one it uses the latest one), so I think that we should see the usage of it and wait for users' requests 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

They support multiple:
image

But again - I don't see it as critical for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I was thinking about providing multiple tags / owners.
I think it could be step 2

@IDoneShaveIt IDoneShaveIt merged commit 2ff7c48 into master Jan 3, 2023
@IDoneShaveIt IDoneShaveIt deleted the alerts-filters branch January 3, 2023 12:32
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.

2 participants