Compare commits

...

4 Commits

Author SHA1 Message Date
Devin AI
bd3f12ed73 Fix lint issue: Sort imports in test_databricks_import.py
Co-Authored-By: Joe Moura <joao@crewai.com>
2025-03-17 18:27:13 +00:00
Devin AI
52aba7abf9 Address PR feedback: Add comments, version verification, and enhanced tests for databricks-sdk
Co-Authored-By: Joe Moura <joao@crewai.com>
2025-03-17 18:24:42 +00:00
Devin AI
ae4649d90c Fix linting issue in test file
Co-Authored-By: Joe Moura <joao@crewai.com>
2025-03-17 18:19:17 +00:00
Devin AI
ad561be4c6 Fix #2390: Add databricks-sdk dependency to tools extra
Co-Authored-By: Joe Moura <joao@crewai.com>
2025-03-17 18:17:38 +00:00
2 changed files with 46 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"]
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

@@ -0,0 +1,42 @@
from importlib.metadata import PackageNotFoundError, version
import pytest
def test_databricks_sdk_import():
"""Test that databricks-sdk can be imported without errors.
This test verifies that the databricks-sdk dependency is properly installed
when using the tools extra, which is required by the databricks_query_tool.
"""
try:
import databricks.sdk
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"