arrowbricks 6.0.1__tar.gz → 6.2.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.0.1 → arrowbricks-6.2.0}/PKG-INFO +15 -8
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/README.md +12 -7
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/pyproject.toml +7 -1
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/Cargo.lock +1 -1
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/Cargo.toml +1 -1
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/examples/agent_render_bench.rs +4 -3
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/agent/mod.rs +7 -3
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/agent/render.rs +304 -31
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/lib.rs +5 -2
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/__init__.py +5 -0
- arrowbricks-6.2.0/src/arrowbricks/_agent.py +11 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/_core.pyi +1 -0
- arrowbricks-6.2.0/src/arrowbricks/_sql.py +259 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/_streaming.py +5 -3
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/cli.py +28 -5
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/client.py +20 -6
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/cursor.py +10 -5
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/LICENSE +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/.gitignore +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/README.md +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/examples/duckdb_query.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/examples/fastapi_sse.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/proptest-regressions/json_convert.txt +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/rustfmt.toml +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/agent/diagnostics.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/alloc.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/arrow_ffi.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/call_context.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/download.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/error.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/model.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/sea.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/thrift_rpc.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client/volume.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/client.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/heartbeat.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/json_convert.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/ndjson.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/reorder.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/sea.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/stats.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/test_support.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline/thrift_exec.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/pipeline.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/src/thrift.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests/common/mod.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests/wiremock_agent.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests/wiremock_pipeline.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests/wiremock_thrift.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests/wiremock_volume_files.rs +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/conftest.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_ipc_stream.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_parameters.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_stream_ndjson_lines.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_streaming.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_thrift.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_token_provider.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/test_volume_files.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/tests_py/thrift_mock.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/__main__.py +0 -0
- {arrowbricks-6.0.1 → arrowbricks-6.2.0}/src/arrowbricks/py.typed +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arrowbricks
|
|
3
|
-
Version: 6.0
|
|
3
|
+
Version: 6.2.0
|
|
4
4
|
Requires-Dist: arro3-core>=0.8 ; extra == 'arro3'
|
|
5
|
+
Requires-Dist: sqlglot>=27 ; extra == 'sqlglot'
|
|
5
6
|
Provides-Extra: arro3
|
|
7
|
+
Provides-Extra: sqlglot
|
|
6
8
|
License-File: LICENSE
|
|
7
9
|
Summary: Rust-powered Databricks SQL client and agent CLI with Arrow/NDJSON streaming, bounded Markdown previews, actionable JSON diagnostics, and zero required Python dependencies.
|
|
8
10
|
License-Expression: MIT
|
|
@@ -19,7 +21,7 @@ Project-URL: Repository, https://github.com/bmsuisse/arrowbricks
|
|
|
19
21
|
|
|
20
22
|
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
21
23
|
- **Fast Rust core.** Concurrent chunk downloads, lazy Arrow decoding, and streaming NDJSON, with result order preserved.
|
|
22
|
-
- **Agent mode, new in 6.0.** A CLI and Python API that return compact typed Markdown, explicit truncation, and actionable JSON errors. Formatting stays in Rust.
|
|
24
|
+
- **Agent mode, new in 6.0.** A CLI and Python API that return compact typed TSV (or a Markdown table), explicit truncation, and actionable JSON errors. Formatting stays in Rust.
|
|
23
25
|
|
|
24
26
|
Use Thrift by default or the Statement Execution API with `protocol="sea"`.
|
|
25
27
|
Bring a token or your own token-refresh callable.
|
|
@@ -32,7 +34,9 @@ pip install arrowbricks
|
|
|
32
34
|
|
|
33
35
|
Wheels cover Linux, macOS, and Windows; Python 3.11+.
|
|
34
36
|
Arrow, NDJSON, and agent mode work without extras. Python row tuples need
|
|
35
|
-
`pip install 'arrowbricks[arro3]'`.
|
|
37
|
+
`pip install 'arrowbricks[arro3]'`; sqlglot expressions as SQL need `[sqlglot]`.
|
|
38
|
+
On Python 3.14+ pass values as a t-string (`t"... WHERE id = {x}"`) and they are
|
|
39
|
+
bound as parameters -- see [SQL safety](docs/usage.md#sql-safety-t-strings-and-literalstring).
|
|
36
40
|
|
|
37
41
|
## Query from an agent or terminal
|
|
38
42
|
|
|
@@ -44,14 +48,17 @@ export DATABRICKS_TOKEN='your-access-token'
|
|
|
44
48
|
arrowbricks -c 'SELECT 1 AS answer'
|
|
45
49
|
```
|
|
46
50
|
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| 1 |
|
|
51
|
+
```text
|
|
52
|
+
answer:Int32
|
|
53
|
+
1
|
|
51
54
|
|
|
52
55
|
rows_shown=1; complete=true; total_rows=1
|
|
53
56
|
```
|
|
54
57
|
|
|
58
|
+
Output is tab-separated by default (cheapest to read; tabs, newlines and
|
|
59
|
+
backslashes in values are escaped, NULL is `\N`). `--format markdown` /
|
|
60
|
+
`output_format="markdown"` gives a pipe table instead.
|
|
61
|
+
|
|
55
62
|
Agent mode is the CLI default. SQL files and piped stdin work too:
|
|
56
63
|
|
|
57
64
|
```bash
|
|
@@ -71,7 +78,7 @@ from arrowbricks import DatabricksClient
|
|
|
71
78
|
|
|
72
79
|
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
73
80
|
text = await client.query_agent("SELECT 1 AS answer", max_bytes=4000)
|
|
74
|
-
print(text) #
|
|
81
|
+
print(text) # TSV on success; JSON on query failure
|
|
75
82
|
```
|
|
76
83
|
|
|
77
84
|
Give your agent the reusable [Arrowbricks skill](skills/arrowbricks/SKILL.md).
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
9
9
|
- **Fast Rust core.** Concurrent chunk downloads, lazy Arrow decoding, and streaming NDJSON, with result order preserved.
|
|
10
|
-
- **Agent mode, new in 6.0.** A CLI and Python API that return compact typed Markdown, explicit truncation, and actionable JSON errors. Formatting stays in Rust.
|
|
10
|
+
- **Agent mode, new in 6.0.** A CLI and Python API that return compact typed TSV (or a Markdown table), explicit truncation, and actionable JSON errors. Formatting stays in Rust.
|
|
11
11
|
|
|
12
12
|
Use Thrift by default or the Statement Execution API with `protocol="sea"`.
|
|
13
13
|
Bring a token or your own token-refresh callable.
|
|
@@ -20,7 +20,9 @@ pip install arrowbricks
|
|
|
20
20
|
|
|
21
21
|
Wheels cover Linux, macOS, and Windows; Python 3.11+.
|
|
22
22
|
Arrow, NDJSON, and agent mode work without extras. Python row tuples need
|
|
23
|
-
`pip install 'arrowbricks[arro3]'`.
|
|
23
|
+
`pip install 'arrowbricks[arro3]'`; sqlglot expressions as SQL need `[sqlglot]`.
|
|
24
|
+
On Python 3.14+ pass values as a t-string (`t"... WHERE id = {x}"`) and they are
|
|
25
|
+
bound as parameters -- see [SQL safety](docs/usage.md#sql-safety-t-strings-and-literalstring).
|
|
24
26
|
|
|
25
27
|
## Query from an agent or terminal
|
|
26
28
|
|
|
@@ -32,14 +34,17 @@ export DATABRICKS_TOKEN='your-access-token'
|
|
|
32
34
|
arrowbricks -c 'SELECT 1 AS answer'
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
| 1 |
|
|
37
|
+
```text
|
|
38
|
+
answer:Int32
|
|
39
|
+
1
|
|
39
40
|
|
|
40
41
|
rows_shown=1; complete=true; total_rows=1
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
Output is tab-separated by default (cheapest to read; tabs, newlines and
|
|
45
|
+
backslashes in values are escaped, NULL is `\N`). `--format markdown` /
|
|
46
|
+
`output_format="markdown"` gives a pipe table instead.
|
|
47
|
+
|
|
43
48
|
Agent mode is the CLI default. SQL files and piped stdin work too:
|
|
44
49
|
|
|
45
50
|
```bash
|
|
@@ -59,7 +64,7 @@ from arrowbricks import DatabricksClient
|
|
|
59
64
|
|
|
60
65
|
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
61
66
|
text = await client.query_agent("SELECT 1 AS answer", max_bytes=4000)
|
|
62
|
-
print(text) #
|
|
67
|
+
print(text) # TSV on success; JSON on query failure
|
|
63
68
|
```
|
|
64
69
|
|
|
65
70
|
Give your agent the reusable [Arrowbricks skill](skills/arrowbricks/SKILL.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "arrowbricks"
|
|
3
|
-
version = "6.0
|
|
3
|
+
version = "6.2.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"
|
|
@@ -21,6 +21,9 @@ arrowbricks = "arrowbricks.cli:main"
|
|
|
21
21
|
# Row materialization converts our capsule table through arro3-core.
|
|
22
22
|
# Arrow fetches and streaming do not need this optional dependency.
|
|
23
23
|
arro3 = ["arro3-core>=0.8"]
|
|
24
|
+
# Only for passing sqlglot expressions as SQL (`Cursor.execute(expr)`); they
|
|
25
|
+
# are rendered in the Databricks dialect. Nothing imports sqlglot at runtime.
|
|
26
|
+
sqlglot = ["sqlglot>=27"]
|
|
24
27
|
|
|
25
28
|
[project.urls]
|
|
26
29
|
Repository = "https://github.com/bmsuisse/arrowbricks"
|
|
@@ -74,6 +77,7 @@ dev = [
|
|
|
74
77
|
"pytest>=8.0",
|
|
75
78
|
"pytest-asyncio>=0.24",
|
|
76
79
|
"ruff>=0.6",
|
|
80
|
+
"sqlglot>=27",
|
|
77
81
|
"ty>=0.0.65",
|
|
78
82
|
]
|
|
79
83
|
|
|
@@ -99,3 +103,5 @@ select = ["E", "F", "I", "UP", "S", "B"]
|
|
|
99
103
|
"tests/*" = ["S101", "S106"]
|
|
100
104
|
"rust/arrowbricks_core/tests_py/*" = ["S101", "S106"]
|
|
101
105
|
"tests/arro3_free/*" = ["S101", "S106"]
|
|
106
|
+
# One-off benchmark harness: terse scripts, seeded (non-crypto) randomness, asserts as checks.
|
|
107
|
+
"benchmarks/agent-output-format/*" = ["B905", "E501", "E731", "E741", "S101", "S311"]
|
{arrowbricks-6.0.1 → arrowbricks-6.2.0}/rust/arrowbricks_core/examples/agent_render_bench.rs
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use arrow_array::types::Int32Type;
|
|
2
2
|
use arrow_array::{ArrayRef, Float64Array, Int64Array, ListArray, RecordBatch, StringArray};
|
|
3
3
|
use arrow_schema::{Field, Schema};
|
|
4
|
-
use arrowbricks_core::agent::render::
|
|
4
|
+
use arrowbricks_core::agent::render::{AgentRenderer, OutputFormat};
|
|
5
5
|
use std::{hint::black_box, sync::Arc, time::Instant};
|
|
6
6
|
|
|
7
7
|
fn batch(columns: Vec<ArrayRef>) -> RecordBatch {
|
|
@@ -14,16 +14,17 @@ fn batch(columns: Vec<ArrayRef>) -> RecordBatch {
|
|
|
14
14
|
}
|
|
15
15
|
fn direct(b: &RecordBatch, bytes: usize, interrupts: bool) -> String {
|
|
16
16
|
let mut renderer = if interrupts {
|
|
17
|
-
|
|
17
|
+
AgentRenderer::new_with_interrupt(
|
|
18
18
|
b.schema(),
|
|
19
19
|
1000,
|
|
20
20
|
bytes,
|
|
21
21
|
500,
|
|
22
|
+
OutputFormat::Markdown,
|
|
22
23
|
Instant::now() + std::time::Duration::from_secs(60),
|
|
23
24
|
Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
|
24
25
|
)
|
|
25
26
|
} else {
|
|
26
|
-
|
|
27
|
+
AgentRenderer::new(b.schema(), 1000, bytes, 500, OutputFormat::Markdown)
|
|
27
28
|
}
|
|
28
29
|
.unwrap();
|
|
29
30
|
renderer.push_batch(b).unwrap();
|
|
@@ -10,7 +10,8 @@ use serde_json::Value;
|
|
|
10
10
|
|
|
11
11
|
use crate::client::{ApiError, DbClient, Protocol};
|
|
12
12
|
use crate::pipeline;
|
|
13
|
-
use render::
|
|
13
|
+
use render::AgentRenderer;
|
|
14
|
+
pub use render::OutputFormat;
|
|
14
15
|
|
|
15
16
|
#[derive(Clone, Copy)]
|
|
16
17
|
pub struct AgentOptions {
|
|
@@ -18,6 +19,7 @@ pub struct AgentOptions {
|
|
|
18
19
|
pub max_bytes: usize,
|
|
19
20
|
pub max_cell_chars: usize,
|
|
20
21
|
pub total_timeout_s: f64,
|
|
22
|
+
pub format: OutputFormat,
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
impl Default for AgentOptions {
|
|
@@ -27,6 +29,7 @@ impl Default for AgentOptions {
|
|
|
27
29
|
max_bytes: 10_000,
|
|
28
30
|
max_cell_chars: 500,
|
|
29
31
|
total_timeout_s: 60.0,
|
|
32
|
+
format: OutputFormat::default(),
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -158,7 +161,7 @@ pub async fn query(
|
|
|
158
161
|
while !finished {
|
|
159
162
|
let want = renderer
|
|
160
163
|
.as_ref()
|
|
161
|
-
.map_or(128, |r: &
|
|
164
|
+
.map_or(128, |r: &AgentRenderer| {
|
|
162
165
|
options.max_rows.saturating_sub(r.rows()).min(128)
|
|
163
166
|
})
|
|
164
167
|
.min(options.max_rows);
|
|
@@ -167,11 +170,12 @@ pub async fn query(
|
|
|
167
170
|
let mut render_task = tokio::task::spawn_blocking(move || {
|
|
168
171
|
let mut renderer = match renderer {
|
|
169
172
|
Some(renderer) => renderer,
|
|
170
|
-
None =>
|
|
173
|
+
None => AgentRenderer::new_with_interrupt(
|
|
171
174
|
schema.unwrap_or_else(|| Arc::new(Schema::empty())),
|
|
172
175
|
options.max_rows,
|
|
173
176
|
options.max_bytes,
|
|
174
177
|
options.max_cell_chars,
|
|
178
|
+
options.format,
|
|
175
179
|
deadline.into_std(),
|
|
176
180
|
interrupted,
|
|
177
181
|
)?,
|