Setup
BigQuery setup
Set up BigQuery for MySQL replication: project and billing, a service account with BigQuery Data Editor and Job User roles, a JSON key, and dataset location.
Project and billing
Use a Google Cloud project with billing turned on and the BigQuery API enabled. Streaming isn't available in the free BigQuery sandbox.
Service account
Create a service account for Quayen and grant it two roles on the project:
- BigQuery Data Editor (
roles/bigquery.dataEditor): create datasets and tables, and write rows. - BigQuery Job User (
roles/bigquery.jobUser): run the queries that apply updates and deletes.
PROJECT_ID=your-project
gcloud iam service-accounts create quayen --project=$PROJECT_ID
for ROLE in roles/bigquery.dataEditor roles/bigquery.jobUser; do
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:quayen@$PROJECT_ID.iam.gserviceaccount.com" --role=$ROLE
done
gcloud iam service-accounts keys create key.json \
--iam-account=quayen@$PROJECT_ID.iam.gserviceaccount.comUpload key.json in Destinations → Connect BigQuery. It is encrypted at rest; delete the key in Google Cloud at any time to revoke access.
Datasets and location
Choose a dataset name for the up-to-date tables (for example analytics). Change history goes to a separate dataset, analytics_changelog by default, so it doesn't clutter your analytics dataset. Both are created in the location you pick (for example US, EU or asia-south1), which can't be changed later.