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

[Feature] Metric filters should be allowed to be non-string types #4294

Closed
1 task done
joellabes opened this issue Nov 17, 2021 · 6 comments
Closed
1 task done

[Feature] Metric filters should be allowed to be non-string types #4294

joellabes opened this issue Nov 17, 2021 · 6 comments
Labels
enhancement New feature or request stale Issues that have gone stale

Comments

@joellabes
Copy link
Contributor

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

Via dbt-labs/docs.getdbt.com#915

In a metric, the filter

  - field: ltv
    operator: ">="
    value: 100

is rejected during compilation at path ['filters'][0]['value']: 100 is not of type 'string'

Types like bools, floats, ints should be allowed as well

Describe alternatives you've considered

Leaving them purely as strings. In that case, we'd need to change the documentation so that filters look like this:

  - field: ltv
    operator: ">="
    value: "100"

  - field: some_string
     operator: "="
     value: "'double quoted'"

Who will this benefit?

People who want to filter metrics in a friendly way

Are you interested in contributing this feature?

No

Anything else?

This would constitute an artifact schema change, and require us to update manifest v4 at schemas.getdbt.com

@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 17, 2021

Thanks @joellabes!

I think this could be as simple as changing this line:

# TODO : Can we make this Any?
value: str

To:

    value: Union[str, int, float, bool]  # others??

Thanks for noting as well that we'll need to update the v4 manifest. It's a tiny change, but a potentially important one for downstream metadata consumers.

@joellabes
Copy link
Contributor Author

joellabes commented Nov 17, 2021

Gave that a whirl, but got
at path ['filters'][0]['value']: 100 is valid under each of {'type': 'number'}, {'type': 'integer'}", "pid": 38112, "ts": "2021-11-17T22:12:44.269034"}

Changing to just

    value: Union[str, int, bool]  # others??

works, but is obviously suboptimal.

Regardless, there's going to be a bunch of testing implications as well so I don't think it's worth me pushing up that one liner - I'll leave it for the pros!

@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Aug 14, 2022
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers.

@joellabes joellabes reopened this Aug 21, 2022
@joellabes joellabes removed the stale Issues that have gone stale label Aug 21, 2022
@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Feb 18, 2023
@github-actions
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

2 participants