-
Notifications
You must be signed in to change notification settings - Fork 7
Move filters to function #336
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
Draft
griffatrasgo
wants to merge
18
commits into
main
Choose a base branch
from
filters-function
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6e4d125
move filters to function
griffatrasgo 40f3f7b
sync master
griffatrasgo 30219b0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9161381
apply PR feedback
griffatrasgo 3ebcd78
added whitespace
kimballh 088e58c
support relative date filters
griffatrasgo ebde58b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 27a72d4
sync master
griffatrasgo ff571d2
Merge branch 'filters-function' of https://github.com/rasgointelligen…
griffatrasgo 232c605
fix
griffatrasgo 1e46b56
fix caps
griffatrasgo 397f97d
handle casing
griffatrasgo 7883b36
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7a4ffbd
introduce comparison value type
griffatrasgo d1114dc
Merge branch 'filters-function' of https://github.com/rasgointelligen…
griffatrasgo dd2eebc
fix it
griffatrasgo 43ef483
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fee6647
bump version
griffatrasgo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,3 +146,5 @@ cython_debug/ | |
| .idea | ||
| test_artifacts/ | ||
| artifacts/ | ||
|
|
||
| pylintrc | ||
1 change: 0 additions & 1 deletion
1
rasgotransforms/rasgotransforms/macros/bigquery/aggregate_metrics.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| {% from 'filter.sql' import get_filter_statement %} | ||
|
|
||
| {% macro get_distinct_vals( | ||
| columns, | ||
| target_metric, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +0,0 @@ | ||
| {% macro get_filter_statement(filters) %} | ||
| {% if filters %} | ||
| {% if filters is string %} | ||
| {{ filters }} | ||
| {% else %} | ||
| {% set logical_operator = namespace(value='AND') %} | ||
| {% for filter in filters %} | ||
| {% if filter is not string %} | ||
| {% if filter is not mapping %} | ||
| {% set filter = dict(filter) %} | ||
| {% endif %} | ||
| {% if filter is mapping and 'compoundBoolean' in filter and filter['compoundBoolean'] %} | ||
| {% set logical_operator.value = filter['compoundBoolean'] %} | ||
| {% endif %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| ( | ||
| {% for filter in filters %} | ||
| {% if filter is not string and filter is not mapping %} | ||
| {% set filter = dict(filter) %} | ||
| {% endif %} | ||
| {% if 'columnName' in filter %} | ||
| {% do filter.__setitem__('column_name', filter.columnName) %} | ||
| {% endif %} | ||
| {% if 'comparisonValue' in filter %} | ||
| {% do filter.__setitem__('comparison_value', filter.comparisonValue) %} | ||
| {% endif %} | ||
| {% if filter is not mapping %} | ||
| {{ logical_operator.value + ' ' if not loop.first }}{{ filter }} | ||
| {% elif filter.operator|upper == 'CONTAINS' %} | ||
| {{ logical_operator.value + ' ' if not loop.first }}{{ filter.column_name }} like '%{{ filter.comparison_value }}%' | ||
| {% else %} | ||
| {{ logical_operator.value + ' ' if not loop.first }}{{ filter.column_name }} {{ filter.operator }} {{ filter.comparison_value }} | ||
| {% endif %} | ||
| {% endfor %} | ||
| ) | ||
| {% endif %} | ||
| {% else %} | ||
| true | ||
| {% endif %} | ||
| {% endmacro %} | ||
|
|
||
|
|
||
| {% macro combine_filters(filters_a, filters_b, condition) %} | ||
| {% set condition = condition if condition is defined else 'AND' %} | ||
| {% if filters_a and not filters_b %} | ||
| {{ get_filter_statement(filters_a) }} | ||
| {% elif filters_b and not filters_a %} | ||
| {{ get_filter_statement(filters_b) }} | ||
| {% elif not filters_a and not filters_b %} | ||
| true | ||
| {% else %} | ||
| ( | ||
| {{ get_filter_statement(filters_a)|indent }} | ||
| {{ condition }} | ||
| {{ get_filter_statement(filters_b)|indent }} | ||
| ) | ||
| {% endif %} | ||
| {% endmacro %} | ||
1 change: 0 additions & 1 deletion
1
rasgotransforms/rasgotransforms/macros/snowflake/aggregate_metrics.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.