Skip to content

Commit 4299956

Browse files
authored
feat: adding postgres application name (#4053)
1 parent 35216a2 commit 4299956

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

docs/integrations/engines/postgres.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ pip install "sqlmesh[postgres]"
1010

1111
### Connection options
1212

13-
| Option | Description | Type | Required |
14-
|-------------------|---------------------------------------------------------------------------------|:------:|:--------:|
15-
| `type` | Engine type name - must be `postgres` | string | Y |
16-
| `host` | The hostname of the Postgres server | string | Y |
17-
| `user` | The username to use for authentication with the Postgres server | string | Y |
18-
| `password` | The password to use for authentication with the Postgres server | string | Y |
19-
| `port` | The port number of the Postgres server | int | Y |
20-
| `database` | The name of the database instance to connect to | string | Y |
21-
| `keepalives_idle` | The number of seconds between each keepalive packet sent to the server. | int | N |
22-
| `connect_timeout` | The number of seconds to wait for the connection to the server. (Default: `10`) | int | N |
23-
| `role` | The role to use for authentication with the Postgres server | string | N |
24-
| `sslmode` | The security of the connection to the Postgres server | string | N |
13+
| Option | Description | Type | Required |
14+
|--------------------|---------------------------------------------------------------------------------|:------:|:--------:|
15+
| `type` | Engine type name - must be `postgres` | string | Y |
16+
| `host` | The hostname of the Postgres server | string | Y |
17+
| `user` | The username to use for authentication with the Postgres server | string | Y |
18+
| `password` | The password to use for authentication with the Postgres server | string | Y |
19+
| `port` | The port number of the Postgres server | int | Y |
20+
| `database` | The name of the database instance to connect to | string | Y |
21+
| `keepalives_idle` | The number of seconds between each keepalive packet sent to the server. | int | N |
22+
| `connect_timeout` | The number of seconds to wait for the connection to the server. (Default: `10`) | int | N |
23+
| `role` | The role to use for authentication with the Postgres server | string | N |
24+
| `sslmode` | The security of the connection to the Postgres server | string | N |
25+
| `application_name` | The name of the application to use for the connection | string | N |
2526

2627
## Airflow Scheduler
2728
**Engine Name:** `postgres`

sqlmesh/core/config/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@ class PostgresConnectionConfig(ConnectionConfig):
11961196
connect_timeout: int = 10
11971197
role: t.Optional[str] = None
11981198
sslmode: t.Optional[str] = None
1199+
application_name: t.Optional[str] = None
11991200

12001201
concurrent_tasks: int = 4
12011202
register_comments: bool = True
@@ -1214,6 +1215,7 @@ def _connection_kwargs_keys(self) -> t.Set[str]:
12141215
"keepalives_idle",
12151216
"connect_timeout",
12161217
"sslmode",
1218+
"application_name",
12171219
}
12181220

12191221
@property

tests/cli/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ def test_init_project_dialects(tmp_path):
11011101
"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: ",
11021102
"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: ",
11031103
"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",
1104-
"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: ",
1104+
"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: ",
11051105
}
11061106

11071107
for dialect, expected_config in dialect_to_config.items():

0 commit comments

Comments
 (0)