Skip to content
8 changes: 7 additions & 1 deletion contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@
3. `python upload-survey-cake-csv-to-bigquery.py --year=<20xx> -c <name of contributor>`
1. it would upload data to Bigquery's `test` dataset
2. If everything looks good, you can `copy` the `fact table` and `dimension table` first
3. Then run `python upload-survey-cake-csv-to-bigquery.py --year=<20xx> -p`. `-p` stands for `production`
3. Then run `python upload-survey-cake-csv-to-bigquery.py --year=<20xx> -p`. `-p` stands for `production`

## KKTIX BigQuery Transform
1. Background: Start from 2022, we extract the KKTIX data via KKTIX API and load to "pycontw-225217.ods.ods_kktix_attendeeId_datetime". However most of the data are store in the ATTENDEE_INFO column with json format. To use metabase with SQL, users need to extract the data by json_extract with the knowledge kktix format instead of flat database. And we also need to rewrite all the SQLs build for current databases.
2. Solution: Transform the tables in backend that we could keep the same user experience by using Metabase.
3. Run:
- for 3 tables in single bash script: `./kktix_bq_etl.sh 2023`
Comment on lines +20 to +26
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for documenting these up 🙏

15 changes: 15 additions & 0 deletions contrib/kktix_bq_etl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# export GOOGLE_APPLICATION_CREDENTIALS="<where to access service-account.json>"
#
project_id="pycontw-225217"
cmd=${PWD}/../dags/ods/kktix_ticket_orders/udfs/kktix_bq_dwd_etl.py


for ticket_type in corporate individual reserved
do
suffix=${ticket_type}_attendees$2
cmd_args="-p ${project_id} -d dwd -t kktix_ticket_${suffix} -k ${ticket_type} -y $1 --upload"
echo ${cmd_args}
${cmd} ${cmd_args}
done
Comment on lines +1 to +15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Loading