arrowbricks 6.0.0__tar.gz → 6.0.1__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/PKG-INFO +125 -0
- arrowbricks-6.0.1/README.md +112 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/pyproject.toml +1 -1
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/Cargo.lock +1 -1
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/Cargo.toml +1 -1
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/cli.py +3 -2
- arrowbricks-6.0.0/PKG-INFO +0 -512
- arrowbricks-6.0.0/README.md +0 -499
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/LICENSE +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/.gitignore +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/README.md +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/examples/agent_render_bench.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/examples/duckdb_query.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/examples/fastapi_sse.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/proptest-regressions/json_convert.txt +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/rustfmt.toml +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/agent/diagnostics.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/agent/mod.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/agent/render.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/alloc.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/arrow_ffi.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/call_context.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/download.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/error.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/model.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/sea.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/thrift_rpc.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client/volume.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/client.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/heartbeat.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/json_convert.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/lib.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/ndjson.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/reorder.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/sea.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/stats.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/test_support.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline/thrift_exec.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/pipeline.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/src/thrift.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests/common/mod.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests/wiremock_agent.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests/wiremock_pipeline.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests/wiremock_thrift.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests/wiremock_volume_files.rs +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/conftest.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_ipc_stream.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_parameters.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_stream_ndjson_lines.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_streaming.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_thrift.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_token_provider.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/test_volume_files.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/rust/arrowbricks_core/tests_py/thrift_mock.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/__init__.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/__main__.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/_core.pyi +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/_streaming.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/client.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/cursor.py +0 -0
- {arrowbricks-6.0.0 → arrowbricks-6.0.1}/src/arrowbricks/py.typed +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arrowbricks
|
|
3
|
+
Version: 6.0.1
|
|
4
|
+
Requires-Dist: arro3-core>=0.8 ; extra == 'arro3'
|
|
5
|
+
Provides-Extra: arro3
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
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
|
+
License-Expression: MIT
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
11
|
+
Project-URL: Repository, https://github.com/bmsuisse/arrowbricks
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="assets/logo.svg" width="72" height="72" alt="arrowbricks logo">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<h1 align="center">arrowbricks</h1>
|
|
18
|
+
<p align="center">Fast Databricks SQL for Python applications and AI agents.</p>
|
|
19
|
+
|
|
20
|
+
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
21
|
+
- **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.
|
|
23
|
+
|
|
24
|
+
Use Thrift by default or the Statement Execution API with `protocol="sea"`.
|
|
25
|
+
Bring a token or your own token-refresh callable.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install arrowbricks
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Wheels cover Linux, macOS, and Windows; Python 3.11+.
|
|
34
|
+
Arrow, NDJSON, and agent mode work without extras. Python row tuples need
|
|
35
|
+
`pip install 'arrowbricks[arro3]'`.
|
|
36
|
+
|
|
37
|
+
## Query from an agent or terminal
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export DATABRICKS_HOST='your-workspace.azuredatabricks.net'
|
|
41
|
+
export DATABRICKS_WAREHOUSE_ID='your-warehouse-id'
|
|
42
|
+
export DATABRICKS_TOKEN='your-access-token'
|
|
43
|
+
|
|
44
|
+
arrowbricks -c 'SELECT 1 AS answer'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
| answer (Int32) |
|
|
49
|
+
| --- |
|
|
50
|
+
| 1 |
|
|
51
|
+
|
|
52
|
+
rows_shown=1; complete=true; total_rows=1
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Agent mode is the CLI default. SQL files and piped stdin work too:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
arrowbricks --file query.sql --max-rows 20 --max-bytes 4000
|
|
59
|
+
printf 'SELECT 1 AS answer' | arrowbricks
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Previews have row, byte, cell, and deadline limits. The footer tells you when
|
|
63
|
+
results are incomplete. Query errors go to stderr as JSON, preserving the
|
|
64
|
+
warehouse's diagnostic and suggestions with a recovery hint; the CLI exits 1.
|
|
65
|
+
Preview limits bound output and fetching, not warehouse scan cost.
|
|
66
|
+
|
|
67
|
+
For Python agents:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from arrowbricks import DatabricksClient
|
|
71
|
+
|
|
72
|
+
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
73
|
+
text = await client.query_agent("SELECT 1 AS answer", max_bytes=4000)
|
|
74
|
+
print(text) # Markdown on success; JSON on query failure
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Give your agent the reusable [Arrowbricks skill](skills/arrowbricks/SKILL.md).
|
|
78
|
+
See [CLI options and skill installation](docs/usage.md#cli-quickstart-60) and
|
|
79
|
+
[agent budgets, completeness, and cancellation](docs/usage.md#agent-results).
|
|
80
|
+
|
|
81
|
+
## Query from an application
|
|
82
|
+
|
|
83
|
+
The async cursor offers familiar `execute` and `fetch*` methods.
|
|
84
|
+
Arrow results work directly with DuckDB, PyArrow, and Polars:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from arrowbricks import connect
|
|
88
|
+
|
|
89
|
+
async with connect(host=..., warehouse_id=..., token=...) as conn:
|
|
90
|
+
cursor = conn.cursor()
|
|
91
|
+
await cursor.execute("SELECT * FROM my_catalog.my_schema.my_table LIMIT 100")
|
|
92
|
+
table = await cursor.fetchall_arrow()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Or consume ready-to-send NDJSON without building Python rows:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from arrowbricks import HEARTBEAT, DatabricksClient
|
|
99
|
+
|
|
100
|
+
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
101
|
+
async for item in client.stream_query_json("SELECT * FROM range(100)"):
|
|
102
|
+
if item is not HEARTBEAT:
|
|
103
|
+
print(item)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Performance
|
|
107
|
+
|
|
108
|
+
The query and formatting work runs in Rust. Agent previews render directly from
|
|
109
|
+
Arrow, avoiding intermediate Python rows or JSON. In a real warehouse test,
|
|
110
|
+
a 100-row preview used **44% fewer bytes and 24% fewer tokens** than NDJSON.
|
|
111
|
+
See [agent measurements and methodology](docs/research/agent-rendering.md) and
|
|
112
|
+
[client benchmarks](docs/benchmarks.md) for workloads, comparisons, and limits.
|
|
113
|
+
|
|
114
|
+
## Learn more
|
|
115
|
+
|
|
116
|
+
- [Usage and API reference](docs/usage.md): authentication, errors, cancellation, observability, and Arrow interop.
|
|
117
|
+
- [Runnable examples](examples/): cursors, agents, OAuth, and FastAPI streaming.
|
|
118
|
+
- [Rust core](rust/arrowbricks_core/README.md): implementation and native APIs.
|
|
119
|
+
- [Real warehouse verification](docs/usage.md#real-warehouse-verification).
|
|
120
|
+
- [Changelog](CHANGELOG.md).
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
125
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.svg" width="72" height="72" alt="arrowbricks logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">arrowbricks</h1>
|
|
6
|
+
<p align="center">Fast Databricks SQL for Python applications and AI agents.</p>
|
|
7
|
+
|
|
8
|
+
- **Zero required Python dependencies.** One precompiled wheel. No Rust toolchain or cloud SDK needed.
|
|
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.
|
|
11
|
+
|
|
12
|
+
Use Thrift by default or the Statement Execution API with `protocol="sea"`.
|
|
13
|
+
Bring a token or your own token-refresh callable.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install arrowbricks
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Wheels cover Linux, macOS, and Windows; Python 3.11+.
|
|
22
|
+
Arrow, NDJSON, and agent mode work without extras. Python row tuples need
|
|
23
|
+
`pip install 'arrowbricks[arro3]'`.
|
|
24
|
+
|
|
25
|
+
## Query from an agent or terminal
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export DATABRICKS_HOST='your-workspace.azuredatabricks.net'
|
|
29
|
+
export DATABRICKS_WAREHOUSE_ID='your-warehouse-id'
|
|
30
|
+
export DATABRICKS_TOKEN='your-access-token'
|
|
31
|
+
|
|
32
|
+
arrowbricks -c 'SELECT 1 AS answer'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
| answer (Int32) |
|
|
37
|
+
| --- |
|
|
38
|
+
| 1 |
|
|
39
|
+
|
|
40
|
+
rows_shown=1; complete=true; total_rows=1
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Agent mode is the CLI default. SQL files and piped stdin work too:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
arrowbricks --file query.sql --max-rows 20 --max-bytes 4000
|
|
47
|
+
printf 'SELECT 1 AS answer' | arrowbricks
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Previews have row, byte, cell, and deadline limits. The footer tells you when
|
|
51
|
+
results are incomplete. Query errors go to stderr as JSON, preserving the
|
|
52
|
+
warehouse's diagnostic and suggestions with a recovery hint; the CLI exits 1.
|
|
53
|
+
Preview limits bound output and fetching, not warehouse scan cost.
|
|
54
|
+
|
|
55
|
+
For Python agents:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from arrowbricks import DatabricksClient
|
|
59
|
+
|
|
60
|
+
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
61
|
+
text = await client.query_agent("SELECT 1 AS answer", max_bytes=4000)
|
|
62
|
+
print(text) # Markdown on success; JSON on query failure
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Give your agent the reusable [Arrowbricks skill](skills/arrowbricks/SKILL.md).
|
|
66
|
+
See [CLI options and skill installation](docs/usage.md#cli-quickstart-60) and
|
|
67
|
+
[agent budgets, completeness, and cancellation](docs/usage.md#agent-results).
|
|
68
|
+
|
|
69
|
+
## Query from an application
|
|
70
|
+
|
|
71
|
+
The async cursor offers familiar `execute` and `fetch*` methods.
|
|
72
|
+
Arrow results work directly with DuckDB, PyArrow, and Polars:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from arrowbricks import connect
|
|
76
|
+
|
|
77
|
+
async with connect(host=..., warehouse_id=..., token=...) as conn:
|
|
78
|
+
cursor = conn.cursor()
|
|
79
|
+
await cursor.execute("SELECT * FROM my_catalog.my_schema.my_table LIMIT 100")
|
|
80
|
+
table = await cursor.fetchall_arrow()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or consume ready-to-send NDJSON without building Python rows:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from arrowbricks import HEARTBEAT, DatabricksClient
|
|
87
|
+
|
|
88
|
+
async with DatabricksClient(host=..., warehouse_id=..., token=...) as client:
|
|
89
|
+
async for item in client.stream_query_json("SELECT * FROM range(100)"):
|
|
90
|
+
if item is not HEARTBEAT:
|
|
91
|
+
print(item)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Performance
|
|
95
|
+
|
|
96
|
+
The query and formatting work runs in Rust. Agent previews render directly from
|
|
97
|
+
Arrow, avoiding intermediate Python rows or JSON. In a real warehouse test,
|
|
98
|
+
a 100-row preview used **44% fewer bytes and 24% fewer tokens** than NDJSON.
|
|
99
|
+
See [agent measurements and methodology](docs/research/agent-rendering.md) and
|
|
100
|
+
[client benchmarks](docs/benchmarks.md) for workloads, comparisons, and limits.
|
|
101
|
+
|
|
102
|
+
## Learn more
|
|
103
|
+
|
|
104
|
+
- [Usage and API reference](docs/usage.md): authentication, errors, cancellation, observability, and Arrow interop.
|
|
105
|
+
- [Runnable examples](examples/): cursors, agents, OAuth, and FastAPI streaming.
|
|
106
|
+
- [Rust core](rust/arrowbricks_core/README.md): implementation and native APIs.
|
|
107
|
+
- [Real warehouse verification](docs/usage.md#real-warehouse-verification).
|
|
108
|
+
- [Changelog](CHANGELOG.md).
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "arrowbricks"
|
|
3
|
-
version = "6.0.
|
|
3
|
+
version = "6.0.1"
|
|
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"
|
|
@@ -74,10 +74,11 @@ async def _run(args: argparse.Namespace, sql: str) -> int:
|
|
|
74
74
|
except (ValueError, OverflowError, TypeError) as exc:
|
|
75
75
|
_configuration_error(str(exc))
|
|
76
76
|
return 2
|
|
77
|
+
# Locale encoding and newline translation must not change the byte budget.
|
|
77
78
|
if result.lstrip().startswith("{"):
|
|
78
|
-
sys.stderr.write(result)
|
|
79
|
+
sys.stderr.buffer.write(result.encode("utf-8"))
|
|
79
80
|
return 1
|
|
80
|
-
sys.stdout.write(result)
|
|
81
|
+
sys.stdout.buffer.write(result.encode("utf-8"))
|
|
81
82
|
return 0
|
|
82
83
|
|
|
83
84
|
|