-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor of get chart data endpoint #139
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
src/dashboard/get_chart_data/templates/get_chart_data.sql.jinja
Outdated
Show resolved
Hide resolved
{%- if stratifier_column %} | ||
"{{ stratifier_column }}", "{{ data_column }}" | ||
{%- else %} | ||
"{{ data_column }}" | ||
{%- endif %} |
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 will point out here that because you don't care about the prettiness of the resulting SQL (right?), you can instead try to make the jinja code more readable / maintainable.
Things like reducing the duplication here:
{%- if stratifier_column %}
"{{ stratifier_column }}",
{%- endif %}
"{{ data_column }}"
And/or proper indenting throughout for the if/else blocks, plus whatever else. The fact that the jinja in Library is usually hard to read is partly our fault.
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.
yeah i think we can make some compromises over here that we cant/wont in the library.
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.
yeah i think we can
makeditch some compromises over here that we cant/wont in the library.
Fixed that for ya 😄
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.
ok, added a sqlfluff config that didn't aggresively squash things.
src/dashboard/get_chart_data/templates/get_chart_data.sql.jinja
Outdated
Show resolved
Hide resolved
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
87ba837
to
a5041f7
Compare
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
src/dashboard/get_chart_data/templates/filter_numeric.sql.jinja
Outdated
Show resolved
Hide resolved
f'SELECT gender, sum(cnt) as cnt FROM "{TEST_GLUE_DB}"."test_study" ' | ||
"WHERE COALESCE (cast(race AS VARCHAR)) IS NOT NULL AND gender IS NOT NULL " | ||
"GROUP BY gender ORDER BY gender", | ||
f"""SELECT |
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.
these are getting particularly irritating to maintain - I did open #140 for considering ditching this in favor of an actual in-DB test.
a5041f7
to
1aadc98
Compare
1aadc98
to
54eba8e
Compare
eb13967
to
af76971
Compare
No description provided.