New to Kestra?
Use blueprints to kickstart your first workflows.
Automated FinOps workflow to query BigQuery INFORMATION_SCHEMA, detect large unpartitioned tables and missing partition filters, and alert Slack.
In Google BigQuery, analysis costs are directly tied to the number of bytes scanned by queries. Unpartitioned tables or tables that do not require partition filters represent a major financial vulnerability: an inexperienced user or runaway dashboard query can trigger full-table scans across multi-terabyte datasets, generating surprise cloud bills within minutes.
This blueprint establishes an automated Data Warehouse governance guardrail for Google BigQuery. Running on a weekly schedule or on-demand, it queries INFORMATION_SCHEMA.TABLE_STORAGE and INFORMATION_SCHEMA.TABLES across your specified dataset, flags tables larger than your threshold that lack date partitioning or mandatory partition filters, and delivers a prioritized remediation digest to your data team on Slack.
weekly_governance_schedule trigger (io.kestra.plugin.core.trigger.Schedule) executes every Monday at 08:00 UTC, or runs on-demand via the Kestra UI.audit_partition_metadata task (io.kestra.plugin.gcp.bigquery.Query) executes an analytical query against BigQuery INFORMATION_SCHEMA. It joins physical storage bytes with table partition flags to classify violations (UNPARTITIONED_LARGE_TABLE, MISSING_PARTITION_FILTER).evaluate_governance_violations flowable task (io.kestra.plugin.core.flow.If) evaluates whether the total count of offending tables exceeds max_allowed_unpartitioned_tables.notify_governance_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) broadcasts an alert detailing the dataset, violation count, and largest offender with remediation steps.export_audit_manifest task records execution audit details and compliance status for data platform tracking.require_partition_filter best practice to prevent accidental full-table scans.Manual table audits are rarely performed consistently, and native GCP alerts do not easily cross-reference table storage size with table partition schema flags. Kestra automates this end-to-end: it securely handles Google Cloud service account authentication, schedules regular audits, branches conditionally based on violation thresholds, and notifies the right team in Slack.
| Name | Type | Default | Description |
|---|---|---|---|
dataset_id |
STRING | analytics_prod |
BigQuery dataset name to audit for partition and expiration compliance. |
max_allowed_unpartitioned_tables |
INT | 0 |
Violation tolerance threshold before triggering a Slack alert. |
min_table_size_mb |
INT | 500 |
Only flag unpartitioned tables larger than this size threshold (MB). |
slack_channel |
STRING | #data-governance |
Slack channel destination for governance compliance reports. |
{{ outputs.audit_partition_metadata.rows }}: Array of non-compliant table records containing table_schema, table_name, size_mb, size_gb, total_rows, is_partitioned, and violation_type.{{ outputs.audit_partition_metadata.size }}: Total number of non-compliant tables discovered during the scan.{{ outputs.evaluate_governance_violations }}: Result of conditional evaluation determining whether Slack notification was dispatched.{{ outputs.export_audit_manifest.value }}: Structured JSON audit manifest containing execution timestamp, dataset ID, and compliance status (PASSED or ACTION_REQUIRED).roles/bigquery.metadataViewer and roles/bigquery.jobUser permissions.GCP_PROJECT_ID: Your Google Cloud Project ID (used to query dataset metadata).GCP_SERVICE_ACCOUNT_JSON: Full JSON key file content of the GCP service account with BigQuery query and metadata permissions.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for sending alert notifications.GCP_PROJECT_ID, GCP_SERVICE_ACCOUNT_JSON, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.roles/bigquery.metadataViewer and roles/bigquery.jobUser. Without metadataViewer, querying INFORMATION_SCHEMA.TABLE_STORAGE will fail with an Access Denied error.INFORMATION_SCHEMA queries must target the exact region where your dataset resides. If your dataset is hosted in a non-US multi-region (e.g. europe-west1), ensure the query job execution location matches.INFORMATION_SCHEMA.TABLE_STORAGE.io.kestra.plugin.notifications.mail.MailSend inside the then: block to email weekly compliance reports to engineering managers.io.kestra.plugin.github.issues.Create task to automatically file tracking tickets for unpartitioned tables exceeding 100 GB.io.kestra.plugin.core.flow.Loop to audit entire enterprise GCP projects.