The dashboard stores and processes its data using a Cloud SQL database. This directory contains helper scripts and configurations to interact with that database.
Once data is processed and stored in the Cloud SQL database, corresponding views are created in BigQuery. These views are then accessed by Looker for reporting and dashboarding.
You can use the scripts in this directory (db, run-proxy) to connect and interact with the Cloud SQL instance locally.
db depends on mysql v8.
- Open
Cloud SQL auth credentials / configfrom 1Password's team vault. Save the following variables in your shell'srcfile (or a file that yourrcfile imports)CLOUD_SQL_DATABASE_USERNAMECLOUD_SQL_DATABASE_PASSWORDCLOUD_SQL_DATABASE_NAME(usepreflight)CLOUD_SQL_DATABASE_HOSTCLOUD_SQL_DATABASE_PORT
- Download
cloud-sql-proxy.jsonfrom 1Password. Save the file somewhere under your home directory. Note the path. - Add
CLOUD_SQL_CREDENTIALSto thercfile. The value is the path ofcloud-sql-proxy.json. - Download the dependencies: Google Cloud CLI and MySQL v8. Ensure both
glcoudandmysqlare covered by$PATH.brew install gcloud-cli brew install mysql@8.4 - Log in to Google Cloud and configure the project name.
Please see a member of Mobile Test Engineering for the GCP project name.
gcloud auth login gcloud config set project [GCP project name] - Download the Cloud SQL Auth Proxy appropriate for your OS.
- Place the binary in the
db/directory. - Open a terminal tab and run:
./run-proxy - In another terminal tab, verify if
./dbcan be run successfully:You should see the help page of the./db -h./dbscript.
$ ./db -h
==============================
Cloud SQL DB
==============================
Syntax: db [--help|--sql|--copy-db|--import|--dump|--dump-data|*]
options:
--sql Run SQL command, then quit. Ex: db -s 'SHOW DATABASES'
--copy-db Copy database to new Ex. db -c <source-db> <target-db>
--import Import SQL data file Ex. db -i <input.sql>
--dump Dump SQL schema + data file Ex. db -d <source-db>
--dump-data Dump SQL data file Ex. db -d <source-db>
--migrate-data Migrate SQL data file Ex. db -d <source-db> <target-db>
* Open mysql CLI client Ex. db