# Template: Load to PostgreSQL
# Copy to your pipeline directory as load.yaml
#
# Write methods:
#   - insert: Insert only (fails on duplicates)
#   - upsert: Insert or update by primary key (default)
#   - replace: Delete and insert
#   - truncate_and_load: Truncate table then insert
#   - update: Update existing records only
#   - delete: Delete matching records

title: load_postgresql
description: Load data into PostgreSQL
version: "1.0.0"

# Target type (required)
type: postgres

# Target table configuration
table: my_table
schema: public
write_method: upsert
primary_key: id  # or ["col1", "col2"] for composite key
batch_size: 1000

# Database connection
database:
  url: ${DATABASE_URL:?DATABASE_URL is required}
  # Format: postgresql://user:password@host:port/database
  # Async: postgresql+asyncpg://user:password@host:port/database

# SSH Tunnel (optional)
# ssh_tunnel:
#   enabled: true
#   host: bastion.example.com
#   port: 22
#   username: ssh_user
#   key_file: ~/.ssh/id_rsa
#   local_port: 5433
