# yaml-language-server: $schema=https://raw.githubusercontent.com/panchenkoai/rivet/main/schemas/latest/rivet.schema.json
#
# Rivet Example: PostgreSQL → Full Export → Local Filesystem
#
# Use case: daily snapshot of a reference table to local Parquet files.
# Run:      rivet run -c examples/pg_full_local.yaml --validate --reconcile
#
# Editor validation: the `$schema` directive on the line above tells the
# YAML Language Server (VS Code, Neovim, Helix) to autocomplete fields,
# flag typos, and surface required keys.  Regenerate the schema with:
#     rivet schema config > schemas/rivet.schema.json

source:
  type: postgres
  # Replace with your connection string, or use url_env: DATABASE_URL
  url: "postgresql://rivet_reader:changeme@localhost:5432/mydb"

exports:
  - name: users_daily
    # The SQL query to export. Tip: only SELECT columns you need.
    query: "SELECT id, name, email, age, balance, is_active, created_at, updated_at FROM users"

    mode: full                      # re-export all rows every run

    format: parquet                 # parquet or csv
    compression: zstd               # zstd (default), snappy, gzip, lz4, none

    skip_empty: true                # don't create a file if 0 rows returned

    meta_columns:
      exported_at: true             # adds _rivet_exported_at column

    destination:
      type: local
      path: ./output                # output directory (created if missing)

    # Optional: tuning overrides (omit to use balanced defaults)
    # tuning:
    #   profile: safe               # safe / balanced / fast
    #   batch_size: 5000            # rows per fetch batch
