version: 1
default_environment: dev
environments:
- name: dev
  env:
    GCP_PROJECT: dev
    ENV: stage
  state_id_suffix: ${TAP_POSTGRES_DATABASE}
- name: prod
  env:
    GCP_PROJECT: prod
    ENV: prod
  state_id_suffix: ${TAP_POSTGRES_DATABASE}
plugins:
  extractors:
  - name: tap-postgres
    variant: meltanolabs
    pip_url: git+https://github.com/MeltanoLabs/tap-postgres.git@v0.3.0
    config:
      start_date: '2024-01-01T00:00:00Z'
      database: ${TAP_POSTGRES_DATABASE}
      flattening_enabled: false
    add_metadata_columns: true
  - name: tap-postgres--myschema
    inherit_from: tap-postgres
    config:
      filter_schemas:
      - myschema
      stream_maps:
        myschema-entity:
          customer_id: int("${CUSTOMER_ID}")
          aliases: str(aliases)
    select:
    - myschema-entity.*
    metadata:
      '*':
        replication-method: INCREMENTAL
        replication_key: last_modified_at
      myschema-entity:
        key_properties: [customer_id, entity_id]
  loaders:
  - name: target-bigquery
    variant: z3z1ma
    pip_url: git+https://github.com/z3z1ma/target-bigquery.git
    config:
      project: ${GCP_PROJECT}
      method: batch_job
      dataset: warehouse
      batch_size: 25000
      denormalized: true
      upsert: true
      cluster_on_key_properties: true
      partition_granularity: day
state_backend:
  uri: gs://company-meltano-state

