databricks-sdk-py
databricks-sdk-py copied to clipboard
Added `w.clusters.commands(cluster_id).run('return [1,2,3]')` utility
Changes
This PR refactors the wrapper around Command Execution API, which was used by dbutils.fs.mounts() and other cluster-proxied dbutils into a dedicated mixin.
Usage:
cluster_id = env_or_skip("TEST_DEFAULT_CLUSTER_ID")
ce = w.clusters.commands(cluster_id=cluster_id)
rows = ce.run('return spark.sql("SHOW DATABASES").collect()')
assert len(rows) > 0
and results:
Tests
- [x]
make testrun locally - [x]
make fmtapplied - [x] relevant integration tests applied
Codecov Report
Patch coverage is 75.41% of modified lines.
| Files Changed | Coverage |
|---|---|
| databricks/sdk/mixins/compute.py | 72.50% |
| databricks/sdk/dbutils.py | 100.00% |
:loudspeaker: Thoughts on this report? Let us know!.