bigquery-etl/sql_generators
kik-kik 9b5c04a7bb
bug(1741487): Rename url2 and related fields in stable views (#4029)
* Bug 1741487 - Rename url2 and related fields in stable views

This removes the following unpopulated fields from Glean views: `metrics.url`, `metrics.text`, `metrics.jwe`, and `metrics.labeled_rate`. If any of these metrics exist in the source table under `2`-suffixed name, it is also aliased to its original name (`url2` to `url` and so on).
Suffixed fields are still preserved until view consumers migrate.

* Remove redundant comma from generated sql

* Ignore missing fields in views if any of them were removed

* added a todo comment

* Added additional context around why we are excluding some of the non-suffixed fields and why alising to remove suffix 2 from some fields

---------

Co-authored-by: Arkadiusz Komarzewski <akomarzewski@mozilla.com>
Co-authored-by: Anna Scholtz <anna@scholtzan.net>
2023-07-10 09:31:15 -07:00
..
active_users DENG-970 Only Glean in Focus Android view. (#3877) 2023-06-02 16:37:40 +00:00
country_code_lookup Adding 3 more Google Analytic country spellings. (#3686) 2023-03-27 14:12:37 -04:00
derived_view_schemas Add --use_cloud_function option when generating SQL queries (#3565) 2023-02-03 14:10:04 -08:00
events_daily Remove java dependency in favor of sqlglot (#3755) 2023-05-17 14:56:42 -07:00
experiment_monitoring Add validation_failed counts to experiment monitoring datasets (#3623) 2023-03-15 14:34:05 -07:00
feature_usage Split main_1pct (#4022) 2023-07-05 13:00:29 -07:00
glean_usage Remove ZetaSQL kludges. (#3898) 2023-06-05 18:03:07 +00:00
search Change `bqetl format` to improve readability of `CASE` statements (#3546) 2023-02-03 14:35:59 -08:00
stable_views bug(1741487): Rename url2 and related fields in stable views (#4029) 2023-07-10 09:31:15 -07:00
README.md DENG-601 Update sql-generators README with deployment info. (#3562) 2023-02-02 18:48:43 +01:00

README.md

SQL generators

sql_generators/ contains scripts for generating SQL queries. Generated SQL query code should not be checked in to main. The scripts for generating SQL queries are executed by CI only and will are followed by generating Airflow DAGs.

Expected structure

The directories in sql_generators/ represent the generated queries and will contain all of the scripts and templates necessary to generate these queries. Each query-specific directory will contain a __init__.py file that contains the query generation logic. Optionally, a templates/ directory can be added which contains the Jinja templates queries are generated from.

Each __init__.py file needs to implement a generate() method that is configured as a click command. The bqetl CLI will automatically add these commands to the ./bqetl query generate command group.

After changes to a schema or adding new tables, the schema is automatically derived from the query and deployed the next day in DAG bqetl_artifact_deployment. Alternatively, it can be manually generated and deployed using ./bqetl generate all and ./bqetl query schema deploy.