# Rivet Example: MySQL → Full Export → Local CSV
#
# Use case: daily CSV dump of a MySQL reference table.
# Run:      rivet run -c examples/mysql_full_local.yaml --validate --reconcile

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

  tuning:
    profile: safe                   # conservative: smaller batches, longer timeouts
    batch_size: 5000

exports:
  - name: users_daily
    query: "SELECT id, name, email, age, balance, is_active, created_at, updated_at FROM users"

    mode: full

    format: csv
    compression: none               # plain CSV (no compression) for easy inspection

    skip_empty: true

    # MySQL does not surface precision/scale for `DECIMAL` columns through
    # the wire protocol, so Rivet refuses to map them by default. Declare
    # the expected `decimal(p,s)` here to match the column definition in
    # the source schema. (PostgreSQL exposes this metadata and does not
    # need the override.) See docs/type-policies.md for details.
    columns:
      balance: decimal(12,2)

    destination:
      type: local
      path: ./output
