Add coalesce to committee_name in ts_vector column #5420
Merged
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.
Summary (required)
When committee name is null, the concatenation that includes committee name will return null. Coalesce function is added to handle this scenario.
Required reviewers
1 developer
How to test
flyway migrate
In common/models/filings.py, set
Before change, no rows returned
https://api.open.fec.gov/v1/filings/?sort=-receipt_date&sort_hide_null=false&sort_nulls_last=false&per_page=20&page=1&sort_null_only=false&q_filer=C00780197&api_key=DEMO_KEY
After change, 9 rows returned
http://127.0.0.1:5000/v1/filings/?page=1&sort_nulls_last=false&q_filer=C00780197&sort=-receipt_date&sort_hide_null=false&per_page=20&sort_null_only=false
In common/models/reports.py, set:
__tablename__ = 'ofec_reports_house_senate_mv_tmp_hc'
Before change, 107 rows returned
https://api.open.fec.gov/v1/reports/house-senate/?per_page=20&q_filer=C00281840&page=1&sort_hide_null=false&sort=cycle&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
After change, 108 rows returned including 1992 YE
http://127.0.0.1:5000/v1/reports/house-senate/?page=1&sort_nulls_last=false&q_filer=C00281840&sort=cycle&sort_hide_null=false&per_page=20&sort_null_only=false
__tablename__ = 'ofec_reports_pac_party_mv_tmp_hc'
Before change, 31 rows returned
https://api.open.fec.gov/v1/reports/pac-party/?per_page=20&q_filer=C00288647&page=1&sort_hide_null=false&sort=cycle&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
After change, 32 rows returned including 1992 YE
http://127.0.0.1:5000/v1/reports/pac-party/?page=1&sort_nulls_last=false&q_filer=C00288647&sort=cycle&sort_hide_null=false&per_page=20&sort_null_only=false
__tablename__ = 'ofec_reports_presidential_mv_tmp_hc'
Before change, 0 row returned
https://api.open.fec.gov/v1/reports/presidential/?per_page=20&q_filer=C00219170&page=1&sort_hide_null=false&sort=-coverage_end_date&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
**After change, 1 row returned **
http://127.0.0.1:5000/v1/reports/presidential/?page=1&sort_nulls_last=false&q_filer=C00219170&sort=-coverage_end_date&sort_hide_null=false&per_page=20&sort_null_only=false
Before change, 4 row returned
https://www.fec.gov/data/reports/presidential/?is_amended=false&data_type=processed&q_filer=C00184572
After change, 5 row returned including TERMINATION REPORT 1985
http://127.0.0.1:5000/v1/reports/presidential/?page=1&sort_nulls_last=false&q_filer=C00184572&sort=-coverage_end_date&sort_hide_null=false&per_page=20&sort_null_only=false