Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions docs/integrations/engines/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ pip install "sqlmesh[postgres]"

### Connection options

| Option | Description | Type | Required |
|-------------------|---------------------------------------------------------------------------------|:------:|:--------:|
| `type` | Engine type name - must be `postgres` | string | Y |
| `host` | The hostname of the Postgres server | string | Y |
| `user` | The username to use for authentication with the Postgres server | string | Y |
| `password` | The password to use for authentication with the Postgres server | string | Y |
| `port` | The port number of the Postgres server | int | Y |
| `database` | The name of the database instance to connect to | string | Y |
| `keepalives_idle` | The number of seconds between each keepalive packet sent to the server. | int | N |
| `connect_timeout` | The number of seconds to wait for the connection to the server. (Default: `10`) | int | N |
| `role` | The role to use for authentication with the Postgres server | string | N |
| `sslmode` | The security of the connection to the Postgres server | string | N |
| Option | Description | Type | Required |
|--------------------|---------------------------------------------------------------------------------|:------:|:--------:|
| `type` | Engine type name - must be `postgres` | string | Y |
| `host` | The hostname of the Postgres server | string | Y |
| `user` | The username to use for authentication with the Postgres server | string | Y |
| `password` | The password to use for authentication with the Postgres server | string | Y |
| `port` | The port number of the Postgres server | int | Y |
| `database` | The name of the database instance to connect to | string | Y |
| `keepalives_idle` | The number of seconds between each keepalive packet sent to the server. | int | N |
| `connect_timeout` | The number of seconds to wait for the connection to the server. (Default: `10`) | int | N |
| `role` | The role to use for authentication with the Postgres server | string | N |
| `sslmode` | The security of the connection to the Postgres server | string | N |
| `application_name` | The name of the application to use for the connection | string | N |

## Airflow Scheduler
**Engine Name:** `postgres`
Expand Down
2 changes: 2 additions & 0 deletions sqlmesh/core/config/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ class PostgresConnectionConfig(ConnectionConfig):
connect_timeout: int = 10
role: t.Optional[str] = None
sslmode: t.Optional[str] = None
application_name: t.Optional[str] = None

concurrent_tasks: int = 4
register_comments: bool = True
Expand All @@ -1214,6 +1215,7 @@ def _connection_kwargs_keys(self) -> t.Set[str]:
"keepalives_idle",
"connect_timeout",
"sslmode",
"application_name",
}

@property
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ def test_init_project_dialects(tmp_path):
"bigquery": "# concurrent_tasks: 1\n # register_comments: True\n # pre_ping: False\n # pretty_sql: False\n # method: oauth\n # project: \n # execution_project: \n # quota_project: \n # location: \n # keyfile: \n # keyfile_json: \n # token: \n # refresh_token: \n # client_id: \n # client_secret: \n # token_uri: \n # scopes: \n # impersonated_service_account: \n # job_creation_timeout_seconds: \n # job_execution_timeout_seconds: \n # job_retries: 1\n # job_retry_deadline_seconds: \n # priority: \n # maximum_bytes_billed: ",
"snowflake": "account: \n # concurrent_tasks: 4\n # register_comments: True\n # pre_ping: False\n # pretty_sql: False\n # user: \n # password: \n # warehouse: \n # database: \n # role: \n # authenticator: \n # token: \n # application: Tobiko_SQLMesh\n # private_key: \n # private_key_path: \n # private_key_passphrase: \n # session_parameters: ",
"databricks": "# concurrent_tasks: 1\n # register_comments: True\n # pre_ping: False\n # pretty_sql: False\n # server_hostname: \n # http_path: \n # access_token: \n # auth_type: \n # oauth_client_id: \n # oauth_client_secret: \n # catalog: \n # http_headers: \n # session_configuration: \n # databricks_connect_server_hostname: \n # databricks_connect_access_token: \n # databricks_connect_cluster_id: \n # databricks_connect_use_serverless: False\n # force_databricks_connect: False\n # disable_databricks_connect: False\n # disable_spark_session: False",
"postgres": "host: \n user: \n password: \n port: \n database: \n # concurrent_tasks: 4\n # register_comments: True\n # pre_ping: True\n # pretty_sql: False\n # keepalives_idle: \n # connect_timeout: 10\n # role: \n # sslmode: ",
"postgres": "host: \n user: \n password: \n port: \n database: \n # concurrent_tasks: 4\n # register_comments: True\n # pre_ping: True\n # pretty_sql: False\n # keepalives_idle: \n # connect_timeout: 10\n # role: \n # sslmode: \n # application_name: ",
}

for dialect, expected_config in dialect_to_config.items():
Expand Down