fix(databricks): use value check for databricks_connect_use_serverless#5883
Open
gabepesco wants to merge 1 commit into
Open
fix(databricks): use value check for databricks_connect_use_serverless#5883gabepesco wants to merge 1 commit into
gabepesco wants to merge 1 commit into
Conversation
Previously, `_set_spark_engine_adapter_if_needed` used a key-presence check (`"databricks_connect_use_serverless" in self._extra_config`) to decide whether to route to serverless. This caused `cluster_id` to be ignored whenever the key existed in config, even if its value was False. Changed to a value check (`self._extra_config.get(...)`) so that `cluster_id` is correctly used when serverless is explicitly disabled. Closes SQLMesh#5842 Signed-off-by: Gabe Pesco <PescoG@medinsight.milliman.com> Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
_set_spark_engine_adapter_if_neededused a key-presence check ("databricks_connect_use_serverless" in self._extra_config) to decide whether to route to serverless. This causedcluster_idto be ignored whenever the key existed in config, even if its value was False.Changed to a value check (
self._extra_config.get(...)) so thatcluster_idis correctly used when serverless is explicitly disabled.Closes #5842
Description
When a user sets
databricks_connect_use_serverless: falsein their config alongside adatabricks_connect_cluster_id, the adapter was ignoring the cluster ID and routing all Databricks Connect sessions to serverless anyway. This is because the routing check in_set_spark_engine_adapter_if_neededtested for the presence of the key in_extra_configrather than its value.The fix changes the check from:
to:
This is consistent with how the same config key is read elsewhere in the codebase (e.g.
_use_spark_sessionandconnection.py).Test Plan
Three new unit tests added to
tests/core/engine_adapter/test_databricks.py:test_databricks_connect_routes_to_cluster_id— verifiescluster_idis passed toDatabricksSession.builder.remotewhen the serverless flag is absenttest_databricks_connect_routes_to_serverless— verifiesserverless=Trueis passed when the flag isTruetest_databricks_connect_cluster_id_not_overridden_by_falsy_serverless— the regression case: verifiescluster_idis still used when the flag is explicitlyFalseChecklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO