FreezerPro → BigQuery sync pipeline. A Python Cloud Function that pulls samples and freezers from the FreezerPro API on a schedule and appends them into BigQuery raw landing tables.
Cloud Scheduler (hourly cron)
│
▼
Cloud Function (gen2, Python 3.11)
│
├─► FreezerPro API ──► method=gen_token ──► auth_token (10-min TTL)
│ ──► method=search_samples (paginated)
│ ──► method=freezers
│
└─► BigQuery
├── lab_freezerpro.samples_raw (partitioned by ingestion_date)
├── lab_freezerpro.freezers_raw (partitioned by ingestion_date)
├── lab_freezerpro.samples_current (view: latest per sample_id)
└── lab_freezerpro.freezers_current (view: latest per freezer_id)
Uses the gen_token method to generate a short-lived auth_token (10-minute TTL, refreshed on each use) from username/password credentials stored in Secret Manager. All subsequent API calls use the token, which avoids "API Session Created/Removed" audit log entries.
echo -n 'your_username' | gcloud secrets versions add freezerpro-username --data-file=- --project=$GCP_PROJECT_ID
echo -n 'your_password' | gcloud secrets versions add freezerpro-password --data-file=- --project=$GCP_PROJECT_IDbq query --use_legacy_sql=false --project_id=$GCP_PROJECT_ID < bigquery_ddl.sqlexport GCP_PROJECT_ID="your-project"
export FREEZERPRO_BASE_URL="https://yourdomain.freezerpro.com"
./deploy.shgcloud functions call freezerpro-sync --gen2 --region=us-central1 --project=$GCP_PROJECT_ID| Variable | Description | Source |
|---|---|---|
FREEZERPRO_BASE_URL |
FreezerPro instance URL (e.g. https://lab.example.com) |
Deploy env var |
FREEZERPRO_USERNAME |
FreezerPro API username | Secret Manager |
FREEZERPRO_PASSWORD |
FreezerPro API password | Secret Manager |
BQ_PROJECT_ID |
GCP project ID | Deploy env var |
BQ_DATASET |
BigQuery dataset (default: lab_freezerpro) |
Deploy env var |
BQ_TABLE_SAMPLES |
Samples table name (default: samples_raw) |
Deploy env var |
BQ_TABLE_FREEZERS |
Freezers table name (default: freezers_raw) |
Deploy env var |
PAGE_SIZE |
Pagination page size (default: 500) |
Deploy env var |
To add more entity types (boxes, vials, sensors), follow the same pattern:
- Add a
fetch_*function using the relevant FreezerPro API method - Add a
normalize_*function mapping to your BQ schema - Add a
CREATE TABLEtobigquery_ddl.sql - Wire it into the entrypoint
MIT