arrowbricks 6.3.0__tar.gz → 6.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/PKG-INFO +2 -4
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/README.md +1 -3
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/pyproject.toml +1 -1
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/Cargo.lock +1 -1
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/Cargo.toml +1 -1
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/README.md +1 -1
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/volume.rs +28 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/lib.rs +12 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/wiremock_volume_files.rs +37 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/_core.pyi +1 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/client.py +5 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/LICENSE +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/.gitignore +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/examples/agent_render_bench.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/examples/duckdb_query.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/examples/fastapi_sse.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/proptest-regressions/json_convert.txt +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/rustfmt.toml +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/agent/diagnostics.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/agent/mod.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/agent/render.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/alloc.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/arrow_ffi.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/call_context.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/download.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/error.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/model.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/sea.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client/thrift_rpc.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/client.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/heartbeat.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/json_convert.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/ndjson.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/reorder.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/sea.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/stats.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/test_support.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline/thrift_exec.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/pipeline.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/src/thrift.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/common/mod.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/wiremock_agent.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/wiremock_pipeline.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/wiremock_thrift.rs +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/conftest.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_ipc_stream.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_parameters.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_stream_ndjson_lines.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_streaming.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_thrift.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_token_provider.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_volume_files.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/thrift_mock.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/__init__.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/__main__.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/_agent.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/_sql.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/_streaming.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/cli.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/cursor.py +0 -0
- {arrowbricks-6.3.0 → arrowbricks-6.4.0}/src/arrowbricks/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arrowbricks
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.4.0
|
|
4
4
|
Requires-Dist: arro3-core>=0.8 ; extra == 'arro3'
|
|
5
5
|
Requires-Dist: sqlglot>=27 ; extra == 'sqlglot'
|
|
6
6
|
Provides-Extra: arro3
|
|
@@ -13,10 +13,8 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
13
13
|
Project-URL: Repository, https://github.com/bmsuisse/arrowbricks
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<img src="assets/logo.svg"
|
|
16
|
+
<img src="assets/logo.svg" height="120" alt="arrowbricks">
|
|
17
17
|
</p>
|
|
18
|
-
|
|
19
|
-
<h1 align="center">arrowbricks</h1>
|
|
20
18
|
<p align="center">Fast Databricks SQL for Python applications and AI agents.</p>
|
|
21
19
|
|
|
22
20
|
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/logo.svg"
|
|
2
|
+
<img src="assets/logo.svg" height="120" alt="arrowbricks">
|
|
3
3
|
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">arrowbricks</h1>
|
|
6
4
|
<p align="center">Fast Databricks SQL for Python applications and AI agents.</p>
|
|
7
5
|
|
|
8
6
|
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "arrowbricks"
|
|
3
|
-
version = "6.
|
|
3
|
+
version = "6.4.0"
|
|
4
4
|
description = "Rust-powered Databricks SQL client and agent CLI with Arrow/NDJSON streaming, bounded Markdown previews, actionable JSON diagnostics, and zero required Python dependencies."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -79,7 +79,7 @@ Arrow library first (e.g. `arro3.core.Table.from_arrow(table)`).
|
|
|
79
79
|
- `ResultSet.schema() -> list[tuple[str, str]] | None` -- the real decoded Arrow schema as `(name, type_name)` string pairs, once known (after >=1 fetch); `None` before that. Computed directly in Rust -- unlike a `Table`'s own `.schema`, this needs no arro3 install.
|
|
80
80
|
- `ResultSet.statement_id`, `ResultSet.num_chunks`, `ResultSet.columns` (manifest-based pre-fetch schema estimate, also arro3-free).
|
|
81
81
|
- `Client.stream_ndjson_lines(statement, *, catalog=None, schema=None, parameters=None, total_timeout_s=None)` -- chunk-at-a-time: an async iterator yielding the `HEARTBEAT` singleton while waiting on the statement or any individual chunk, then a `list[str]` of NDJSON lines (one per row, explicit nulls, ISO-8601 timestamps) per chunk in logical order. Decode and JSON encoding both happen in Rust -- backs `stream_query_json` end to end.
|
|
82
|
-
- `Client.upload_volume_file(volume_path, data: bytes)` / `Client.delete_volume_file(volume_path)` -- Unity Catalog volume files via the Files API. Delete treats a 404 as success (idempotent). Both raise a plain `RuntimeError` (message only) on failure.
|
|
82
|
+
- `Client.upload_volume_file(volume_path, data: bytes)` / `Client.download_volume_file(volume_path) -> bytes` / `Client.delete_volume_file(volume_path)` -- Unity Catalog volume files via the Files API. Delete treats a 404 as success (idempotent). Both raise a plain `RuntimeError` (message only) on failure.
|
|
83
83
|
- `write_ipc_stream(stream, buf)` -- free function; writes any object implementing `__arrow_c_stream__` (a `Table` from this crate, arro3, pyarrow, ...) as uncompressed Arrow-IPC stream bytes to a Python file-like object. No dependency needed regardless of the input's origin.
|
|
84
84
|
- `read_ipc_stream(data: bytes) -> Table` -- free function; the exact inverse of `write_ipc_stream`, parsing raw Arrow-IPC stream bytes back into a `Table`. No dependency needed regardless of where the bytes came from -- backs `arrowbricks.ReplayableArrowChunk`, which needs to re-parse the same cached bytes on every `__arrow_c_stream__` call. Decoding releases the Python interpreter lock so independent replay calls can run concurrently; decoded arrays retain ownership of the immutable input bytes.
|
|
85
85
|
- `HEARTBEAT` -- module-level singleton; compare with `is`, e.g. `if item is _core.HEARTBEAT: ...`.
|
|
@@ -57,6 +57,34 @@ impl DbClient {
|
|
|
57
57
|
.await
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/// Downloads a Unity Catalog volume file in one GET on the pooled
|
|
61
|
+
/// connection. Single request on purpose: for typical files the server's
|
|
62
|
+
/// time-to-first-byte dominates, so range-splitting only adds round trips.
|
|
63
|
+
/// A non-2xx (incl. 404) is an error, unlike delete.
|
|
64
|
+
pub async fn download_volume_file(&self, volume_path: &str) -> Result<Bytes, ApiError> {
|
|
65
|
+
let url = format!("{}/api/2.0/fs/files{}", self.host, volume_path);
|
|
66
|
+
self.retry_call(|| async {
|
|
67
|
+
let token = self.token_provider.get_token().await?;
|
|
68
|
+
// No total request timeout: headers get `http_timeout`, the body a
|
|
69
|
+
// deadline scaled to Content-Length (same 1 MiB/s floor as upload).
|
|
70
|
+
let resp = tokio::time::timeout(self.http_timeout, self.http.get(&url).bearer_auth(&token).send())
|
|
71
|
+
.await
|
|
72
|
+
.map_err(|_| ApiError::permanent("volume download timed out waiting for response headers"))?
|
|
73
|
+
.map_err(|e| ApiError::from_reqwest(e, true))?;
|
|
74
|
+
let status = resp.status();
|
|
75
|
+
if !status.is_success() {
|
|
76
|
+
let text = resp.text().await.unwrap_or_default();
|
|
77
|
+
return Err(ApiError::from_status(status, &text, true));
|
|
78
|
+
}
|
|
79
|
+
let deadline = upload_deadline(self.http_timeout, resp.content_length().unwrap_or(0) as usize);
|
|
80
|
+
tokio::time::timeout(deadline, resp.bytes())
|
|
81
|
+
.await
|
|
82
|
+
.map_err(|_| ApiError::permanent("volume download timed out reading body"))?
|
|
83
|
+
.map_err(|e| ApiError::from_reqwest(e, true))
|
|
84
|
+
})
|
|
85
|
+
.await
|
|
86
|
+
}
|
|
87
|
+
|
|
60
88
|
/// Deletes a file at `volume_path` (see `upload_volume_file`). A 404 is
|
|
61
89
|
/// treated as success -- the file is already gone, which is fine for
|
|
62
90
|
/// idempotent staging cleanup.
|
|
@@ -923,6 +923,18 @@ impl PyDbClient {
|
|
|
923
923
|
})
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
+
/// Downloads the file at `volume_path` and returns its contents as `bytes`.
|
|
927
|
+
fn download_volume_file<'py>(&self, py: Python<'py>, volume_path: String) -> PyResult<Bound<'py, PyAny>> {
|
|
928
|
+
let client = self.inner.clone();
|
|
929
|
+
future_into_py_in_call(py, async move {
|
|
930
|
+
let data = client
|
|
931
|
+
.download_volume_file(&volume_path)
|
|
932
|
+
.await
|
|
933
|
+
.map_err(api_error_to_pyerr)?;
|
|
934
|
+
Ok(Python::attach(|py| pyo3::types::PyBytes::new(py, &data).unbind()))
|
|
935
|
+
})
|
|
936
|
+
}
|
|
937
|
+
|
|
926
938
|
/// Deletes a file at `volume_path` (see `upload_volume_file`). A 404 is
|
|
927
939
|
/// treated as success -- the file is already gone, fine for idempotent
|
|
928
940
|
/// staging cleanup.
|
{arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests/wiremock_volume_files.rs
RENAMED
|
@@ -29,6 +29,43 @@ async fn upload_volume_file_sends_overwrite_and_content_type() {
|
|
|
29
29
|
.unwrap();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
#[tokio::test]
|
|
33
|
+
async fn download_volume_file_returns_exact_body() {
|
|
34
|
+
let server = MockServer::start().await;
|
|
35
|
+
let body = vec![0u8, 255, 1, 254, b'%', b'P', b'D', b'F'];
|
|
36
|
+
Mock::given(method("GET"))
|
|
37
|
+
.and(path_regex(r"^/api/2\.0/fs/files/Volumes/cat/schema/vol/file\.pdf$"))
|
|
38
|
+
.respond_with(ResponseTemplate::new(200).set_body_bytes(body.clone()))
|
|
39
|
+
.mount(&server)
|
|
40
|
+
.await;
|
|
41
|
+
|
|
42
|
+
let client = Arc::new(DbClient::new(&server.uri(), WAREHOUSE_ID, "fake-token"));
|
|
43
|
+
let got = client
|
|
44
|
+
.download_volume_file("/Volumes/cat/schema/vol/file.pdf")
|
|
45
|
+
.await
|
|
46
|
+
.unwrap();
|
|
47
|
+
assert_eq!(got.as_ref(), body.as_slice());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[tokio::test]
|
|
51
|
+
async fn download_volume_file_404_is_an_error() {
|
|
52
|
+
let server = MockServer::start().await;
|
|
53
|
+
Mock::given(method("GET"))
|
|
54
|
+
.respond_with(ResponseTemplate::new(404).set_body_string("not found"))
|
|
55
|
+
.mount(&server)
|
|
56
|
+
.await;
|
|
57
|
+
|
|
58
|
+
let client = Arc::new(DbClient::new(&server.uri(), WAREHOUSE_ID, "fake-token"));
|
|
59
|
+
let err = client
|
|
60
|
+
.download_volume_file("/Volumes/cat/schema/vol/missing.pdf")
|
|
61
|
+
.await
|
|
62
|
+
.unwrap_err();
|
|
63
|
+
assert!(
|
|
64
|
+
err.message.contains("404") || err.message.contains("not found"),
|
|
65
|
+
"{err}"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
32
69
|
#[tokio::test]
|
|
33
70
|
async fn delete_volume_file_succeeds_on_204() {
|
|
34
71
|
let server = MockServer::start().await;
|
|
@@ -118,6 +118,7 @@ class Client:
|
|
|
118
118
|
async def upload_volume_file(
|
|
119
119
|
self, volume_path: str, data: bytes | bytearray | memoryview | array.array | Sequence[int]
|
|
120
120
|
) -> None: ...
|
|
121
|
+
async def download_volume_file(self, volume_path: str) -> bytes: ...
|
|
121
122
|
async def delete_volume_file(self, volume_path: str) -> None: ...
|
|
122
123
|
async def close_sessions(self) -> None: ...
|
|
123
124
|
def stream_ndjson_lines(
|
|
@@ -157,6 +157,11 @@ class DatabricksClient:
|
|
|
157
157
|
failure."""
|
|
158
158
|
await self._core_client.upload_volume_file(volume_path, data)
|
|
159
159
|
|
|
160
|
+
async def download_volume_file(self, volume_path: str) -> bytes:
|
|
161
|
+
"""Downloads the file at `volume_path` (see upload_volume_file) and
|
|
162
|
+
returns its contents. Raises on a missing file (404)."""
|
|
163
|
+
return await self._core_client.download_volume_file(volume_path)
|
|
164
|
+
|
|
160
165
|
async def delete_volume_file(self, volume_path: str) -> None:
|
|
161
166
|
"""Deletes a file at `volume_path` (see upload_volume_file). A 404 is
|
|
162
167
|
treated as success -- the file is already gone, which is fine for
|
|
File without changes
|
|
File without changes
|
{arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/examples/agent_render_bench.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/proptest-regressions/json_convert.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_stream_ndjson_lines.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arrowbricks-6.3.0 → arrowbricks-6.4.0}/rust/arrowbricks_core/tests_py/test_token_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|