From 7607d6c1316bb550c3d47d79ca648dddf3ba143b Mon Sep 17 00:00:00 2001 From: Carlos Duarte Date: Mon, 24 Mar 2025 16:21:25 +0000 Subject: [PATCH 1/2] Add host/port to snowflake connection settings. --- sqlmesh/core/config/connection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sqlmesh/core/config/connection.py b/sqlmesh/core/config/connection.py index 133ee3311..5ef7c2403 100644 --- a/sqlmesh/core/config/connection.py +++ b/sqlmesh/core/config/connection.py @@ -407,6 +407,8 @@ class SnowflakeConnectionConfig(ConnectionConfig): register_comments: Whether or not to register model comments with the SQL engine. pre_ping: Whether or not to pre-ping the connection before starting a new transaction to ensure it is still alive. session_parameters: The optional session parameters to set for the connection. + host: Host address for the connection. + port: Port for the connection. """ account: str @@ -417,6 +419,8 @@ class SnowflakeConnectionConfig(ConnectionConfig): role: t.Optional[str] = None authenticator: t.Optional[str] = None token: t.Optional[str] = None + host: t.Optional[str] = None + port: t.Optional[int] = None application: t.Literal["Tobiko_SQLMesh"] = "Tobiko_SQLMesh" # Private Key Auth @@ -550,6 +554,8 @@ def _connection_kwargs_keys(self) -> t.Set[str]: "private_key", "session_parameters", "application", + "host", + "port", } @property From 9aaed5e24dabec371adc218fbaf33ff7fe9ac518 Mon Sep 17 00:00:00 2001 From: Carlos Duarte Date: Thu, 27 Mar 2025 15:53:21 +0000 Subject: [PATCH 2/2] Fix test to support new snowflake port/host connection parameters. --- tests/cli/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index cf4860c97..bdab757cc 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -1099,7 +1099,7 @@ def test_init_project_dialects(tmp_path): dialect_to_config = { "redshift": "# concurrent_tasks: 4\n # register_comments: True\n # pre_ping: False\n # pretty_sql: False\n # user: \n # password: \n # database: \n # host: \n # port: \n # source_address: \n # unix_sock: \n # ssl: \n # sslmode: \n # timeout: \n # tcp_keepalive: \n # application_name: \n # preferred_role: \n # principal_arn: \n # credentials_provider: \n # region: \n # cluster_identifier: \n # iam: \n # is_serverless: \n # serverless_acct_id: \n # serverless_work_group: \n # enable_merge: ", "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: ", + "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 # host: \n # port: \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: ", }