BrianLii commented on code in PR #53217: URL: https://github.com/apache/airflow/pull/53217#discussion_r2206968478
########## providers/databricks/tests/unit/databricks/hooks/test_databricks_sql.py: ########## @@ -107,6 +112,41 @@ def mock_timer(): yield mock_timer +def make_mock_connection(): + return Connection( + conn_id=DEFAULT_CONN_ID, + conn_type="databricks", + host=HOST, + port=PORT, + login="token", + password=TOKEN, + ) + + +def test_sqlachemy_url_property(mock_get_conn): + mock_get_conn.return_value = make_mock_connection() + hook = DatabricksSqlHook( + databricks_conn_id=DEFAULT_CONN_ID, http_path=HTTP_PATH, catalog=CATALOG, schema=SCHEMA + ) + url = hook.sqlalchemy_url.render_as_string(hide_password=False) + assert url.startswith(f"databricks://token:{TOKEN}@{HOST}:{PORT}") + assert f"http_path={quote_plus(HTTP_PATH)}" in url + assert f"catalog={CATALOG}" in url + assert f"schema={SCHEMA}" in url Review Comment: Hi Jason, thanks for the review. Since the rendered URL does not guarantee the order of the parameters, I think it is better to use `urllib.parse` to parse and check the returned parameters. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org