Address PR feedback: Add comments, version verification, and enhanced tests for databricks-sdk

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-03-17 18:24:42 +00:00
parent ae4649d90c
commit 52aba7abf9
2 changed files with 31 additions and 1 deletions

View File

@@ -45,7 +45,10 @@ Documentation = "https://docs.crewai.com"
Repository = "https://github.com/crewAIInc/crewAI"
[project.optional-dependencies]
tools = ["crewai-tools>=0.37.0", "databricks-sdk>=0.46.0"]
tools = [
"crewai-tools>=0.37.0",
"databricks-sdk>=0.46.0,<1.0.0" # Required for Databricks query tool functionality
]
embeddings = [
"tiktoken~=0.7.0"
]

View File

@@ -1,4 +1,5 @@
import pytest
from importlib.metadata import version, PackageNotFoundError
def test_databricks_sdk_import():
@@ -12,3 +13,29 @@ def test_databricks_sdk_import():
assert True
except ImportError as e:
pytest.fail(f"Failed to import databricks.sdk: {e}")
def test_databricks_sdk_version():
"""Test that the installed databricks-sdk version meets requirements.
The databricks-sdk should be version 0.46.0 or higher, but less than 1.0.0
to maintain compatibility with the databricks_query_tool.
"""
try:
sdk_version = version("databricks-sdk")
assert sdk_version >= "0.46.0", f"Databricks SDK version {sdk_version} is too old (< 0.46.0)"
assert sdk_version < "1.0.0", f"Databricks SDK version {sdk_version} is too new (>= 1.0.0)"
except PackageNotFoundError:
pytest.fail("databricks-sdk package not found")
def test_databricks_core_functionality():
"""Test core functionality of the Databricks SDK.
This test verifies that the WorkspaceClient class from the Databricks SDK
has the expected attributes for SQL functionality.
"""
from databricks.sdk import WorkspaceClient
# Verify that the WorkspaceClient class has the expected attributes for SQL operations
assert hasattr(WorkspaceClient, 'statement_execution'), "SQL statement execution functionality not available in WorkspaceClient"