|
7 | 7 |
|
8 | 8 | ## Example 1: PostgreSQL with DSN (recommended) |
9 | 9 | [[sources]] |
10 | | -id = "prod_pg" |
11 | | -dsn = "postgres://user:password@localhost:5432/production?sslmode=require" |
12 | | -readonly = false |
13 | | -max_rows = 1000 |
| 10 | +id = "prod_pg" # Required: Unique identifier |
| 11 | +dsn = "postgres://user:password@localhost:5432/production?sslmode=require" # Required: Connection string |
| 12 | +readonly = false # Optional: Limit to read-only operations (default: false) |
| 13 | +max_rows = 1000 # Optional: Maximum rows to return per query (default: unlimited) |
| 14 | +connection_timeout = 30 # Optional: Connection timeout in seconds (default: driver-specific) |
14 | 15 |
|
15 | 16 | ## Example 2: MySQL with individual parameters |
16 | 17 | [[sources]] |
17 | | -id = "staging_mysql" |
18 | | -type = "mysql" |
19 | | -host = "localhost" |
20 | | -port = 3306 |
21 | | -database = "staging" |
22 | | -user = "root" |
23 | | -password = "secret" |
24 | | -readonly = false |
25 | | -max_rows = 500 |
| 18 | +id = "staging_mysql" # Required: Unique identifier |
| 19 | +type = "mysql" # Required when using individual parameters (not DSN) |
| 20 | +host = "localhost" # Required when using individual parameters |
| 21 | +port = 3306 # Optional: Uses default if not specified (MySQL default: 3306) |
| 22 | +database = "staging" # Required: Database name |
| 23 | +user = "root" # Required: Database username |
| 24 | +password = "secret" # Required: Database password |
| 25 | +readonly = false # Optional: Limit to read-only operations (default: false) |
| 26 | +max_rows = 500 # Optional: Maximum rows to return per query (default: unlimited) |
| 27 | +connection_timeout = 60 # Optional: Connection timeout in seconds (useful for high-latency connections) |
26 | 28 |
|
27 | 29 | ## Example 3: MariaDB with SSH tunnel |
28 | 30 | [[sources]] |
29 | | -id = "remote_mariadb" |
30 | | -dsn = "mariadb://dbuser:[email protected]:3306/mydb" |
31 | | -ssh_host = "bastion.example.com" |
32 | | -ssh_port = 22 |
33 | | -ssh_user = "ubuntu" |
34 | | -ssh_key = "~/.ssh/id_rsa" |
35 | | -# ssh_passphrase = "optional_key_passphrase" |
36 | | -# ssh_password = "optional_ssh_password" # Use instead of ssh_key for password auth |
| 31 | +id = "remote_mariadb" # Required: Unique identifier |
| 32 | +dsn = "mariadb://dbuser:[email protected]:3306/mydb" # Required: Connection string (target DB behind SSH tunnel) |
| 33 | +ssh_host = "bastion.example.com" # Optional: SSH server hostname (required if using SSH tunnel) |
| 34 | +ssh_port = 22 # Optional: SSH server port (default: 22) |
| 35 | +ssh_user = "ubuntu" # Optional: SSH username (required if using SSH tunnel) |
| 36 | +ssh_key = "~/.ssh/id_rsa" # Optional: Path to private key file (use ssh_key OR ssh_password) |
| 37 | +# ssh_passphrase = "key_passphrase" # Optional: Passphrase for encrypted private key |
| 38 | +# ssh_password = "ssh_password" # Optional: SSH password (use instead of ssh_key for password auth) |
37 | 39 |
|
38 | | -## Example 4: SQL Server |
| 40 | +## Example 4: SQL Server with timeouts |
39 | 41 | [[sources]] |
40 | | -id = "analytics_sqlserver" |
41 | | -type = "sqlserver" |
42 | | -host = "sqlserver.example.com" |
43 | | -port = 1433 |
44 | | -database = "analytics" |
45 | | -user = "sa" |
46 | | -password = "YourStrong@Passw0rd" |
47 | | -max_rows = 2000 |
48 | | -# instanceName = "optional_instance_name" |
| 42 | +id = "analytics_sqlserver" # Required: Unique identifier |
| 43 | +type = "sqlserver" # Required when using individual parameters |
| 44 | +host = "sqlserver.example.com" # Required when using individual parameters |
| 45 | +port = 1433 # Optional: Uses default if not specified (SQL Server default: 1433) |
| 46 | +database = "analytics" # Required: Database name |
| 47 | +user = "sa" # Required: Database username |
| 48 | +password = "YourStrong@Passw0rd" # Required: Database password |
| 49 | +max_rows = 2000 # Optional: Maximum rows to return per query (default: unlimited) |
| 50 | +connection_timeout = 30 # Optional: Connection establishment timeout in seconds (default: 15s) |
| 51 | +request_timeout = 120 # Optional: Query execution timeout in seconds (SQL Server only, default: 15s) |
| 52 | +# instanceName = "INSTANCE1" # Optional: SQL Server named instance (e.g., SERVER\INSTANCE1) |
49 | 53 |
|
50 | 54 | ## Example 5: SQLite local file |
51 | 55 | [[sources]] |
52 | | -id = "local_sqlite" |
53 | | -type = "sqlite" |
54 | | -database = "/path/to/database.db" |
55 | | -readonly = true |
| 56 | +id = "local_sqlite" # Required: Unique identifier |
| 57 | +type = "sqlite" # Required when using individual parameters |
| 58 | +database = "/path/to/database.db" # Required: Path to SQLite database file |
| 59 | +readonly = true # Optional: Limit to read-only operations (default: false) |
56 | 60 |
|
57 | 61 | ## Example 6: SQLite in-memory (for testing) |
58 | 62 | [[sources]] |
59 | | -id = "test_db" |
60 | | -dsn = "sqlite:///:memory:" |
| 63 | +id = "test_db" # Required: Unique identifier |
| 64 | +dsn = "sqlite:///:memory:" # Required: Connection string (in-memory database) |
61 | 65 |
|
62 | 66 | # Connection Parameters Reference: |
63 | 67 | # ------------------------------- |
64 | | -# Required for each source: |
65 | | -# - id: Unique identifier for this database source |
66 | 68 | # |
67 | | -# Connection options (choose one): |
68 | | -# Option A: Full DSN string |
69 | | -# - dsn: Complete connection string (e.g., "postgres://user:pass@host:port/db") |
| 69 | +# REQUIRED FIELDS: |
| 70 | +# ---------------- |
| 71 | +# - id: Unique identifier for this database source (string) |
70 | 72 | # |
71 | | -# Option B: Individual parameters |
72 | | -# - type: Database type (postgres, mysql, mariadb, sqlserver, sqlite) |
73 | | -# - host: Database host (not needed for sqlite) |
74 | | -# - port: Database port (optional, uses default if not specified) |
75 | | -# - database: Database name or file path (for sqlite) |
76 | | -# - user: Database username (not needed for sqlite) |
77 | | -# - password: Database password (not needed for sqlite) |
78 | | -# - instanceName: SQL Server named instance (optional, for sqlserver only) |
| 73 | +# AND one of: |
| 74 | +# Option A: DSN (connection string) |
| 75 | +# - dsn: Complete connection string (e.g., "postgres://user:pass@host:port/db") |
79 | 76 | # |
80 | | -# Execution options (optional): |
| 77 | +# Option B: Individual connection parameters |
| 78 | +# - type: Database type (postgres, mysql, mariadb, sqlserver, sqlite) [REQUIRED] |
| 79 | +# - database: Database name or file path [REQUIRED] |
| 80 | +# For network databases (postgres, mysql, mariadb, sqlserver): |
| 81 | +# - host: Database host [REQUIRED] |
| 82 | +# - user: Database username [REQUIRED] |
| 83 | +# - password: Database password [REQUIRED] |
| 84 | +# For SQLite: only database path is needed |
| 85 | +# |
| 86 | +# OPTIONAL FIELDS: |
| 87 | +# ---------------- |
| 88 | +# Connection parameters: |
| 89 | +# - port: Database port (default: 5432 for postgres, 3306 for mysql/mariadb, 1433 for sqlserver) |
| 90 | +# - instanceName: SQL Server named instance (sqlserver only, e.g., "INSTANCE1") |
| 91 | +# |
| 92 | +# Execution options: |
81 | 93 | # - readonly: Limit to read-only operations (default: false) |
82 | | -# - max_rows: Maximum rows to return per query (default: unlimited) |
| 94 | +# - max_rows: Maximum rows to return per query (default: unlimited, e.g., 1000) |
| 95 | +# - connection_timeout: Connection timeout in seconds (default: driver-specific, e.g., 30, 60) |
| 96 | +# - request_timeout: Query execution timeout in seconds (SQL Server only, default: 15, e.g., 120) |
83 | 97 | # |
84 | | -# SSH tunnel options (optional): |
| 98 | +# SSH tunnel options (all optional, but if using SSH tunnel, ssh_host, ssh_user required): |
85 | 99 | # - ssh_host: SSH server hostname or IP |
86 | 100 | # - ssh_port: SSH server port (default: 22) |
87 | 101 | # - ssh_user: SSH username |
88 | | -# - ssh_password: SSH password (for password authentication) |
89 | | -# - ssh_key: Path to private key file (for key-based authentication) |
90 | | -# - ssh_passphrase: Passphrase for encrypted private key (optional) |
| 102 | +# - ssh_key: Path to private key file (use ssh_key OR ssh_password, not both) |
| 103 | +# - ssh_password: SSH password (use instead of ssh_key for password authentication) |
| 104 | +# - ssh_passphrase: Passphrase for encrypted private key |
91 | 105 |
|
92 | 106 | # Default Port Numbers: |
93 | 107 | # - PostgreSQL: 5432 |
|
0 commit comments