version: 1

# Manifest-driven GCS load (ADR 0017) for the cloud_tenants BigQuery snapshot. This is the
# extract-then-load counterpart to ingestion/extract/bigquery/sources/cloud_tenants: that stage
# `bq extract`s the table to GCS and owns the GCS-snapshot `source` contract; this load reads the
# manifest, COPY INTOs the raw layer, and owns the raw-snapshot `product` contract (ADR 0016).
# No `external:` block — unlike the metadb external-incremental load, here we own the extract.
#
# Replaces today's hand-loaded fixture (transform/dbt/engine/fixtures/cloud_tenants_fixture.sql).

load:
  name: cloud_tenants
  engine: databend
  secrets_file: secrets.env

cloud_lake:
  dsn_env: DATABEND_DSN
  databases:
    raw: bq_warehouse_raw

gcs:
  # Read credential for the COPY INTO: base64 service-account key JSON that can read the export
  # bucket. Provisioned by the extract stage's setup/grunt (the extract owns the bucket + reader SA).
  credential_env: CLOUD_TENANTS_GCS_CREDENTIAL
  reader:
    project: REPLACE-WITH-GCP-PROJECT

setup:
  databend:
    files:
      - ingestion/load/gcs_bulk_load/setup/databend/cloud_tenants/001_databases.sql

# Consumes the GCS-snapshot source contract the bigquery extract owns; from it this load generates
# and owns the raw-snapshot product contract (under contracts/generated/ via generate-contracts).
source_contracts:
  - ref: ingestion/extract/bigquery/sources/cloud_tenants/contracts/generated/*.gcs-snapshot.source.contract.yaml
