streaming-sql-engine 0.2.0__tar.gz → 0.2.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.
- streaming_sql_engine-0.2.0/README.md → streaming_sql_engine-0.2.1/PKG-INFO +126 -3
- streaming_sql_engine-0.2.0/PKG-INFO → streaming_sql_engine-0.2.1/README.md +1691 -1672
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/__init__.py +1 -1
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/jobs.py +165 -165
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/server.py +288 -246
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/static/app.css +467 -457
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/static/app.js +1283 -1008
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/static/index.html +202 -239
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/worker.py +819 -620
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/pyproject.toml +1 -1
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/MANIFEST.in +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/__init__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/__main__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/demo.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/app/sources.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/__init__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/evaluator.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/executor.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/optimizer.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/parser.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/core/planner.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/engine.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/operators/__init__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/operators/base.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/operators/mmap.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/operators/polars.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/polars_utils/__init__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/polars_utils/operators.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/polars_utils/translator.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/requirements.txt +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/run_app.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/setup.cfg +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/storage/__init__.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/storage/file_index.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/storage/mmap_index.py +0 -0
- {streaming_sql_engine-0.2.0 → streaming_sql_engine-0.2.1}/streaming_sql_engine.egg-info/SOURCES.txt +0 -0
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: streaming-sql-engine
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Streaming SQL Engine: Lightweight Cross Data Source Integration for Resource Constraint Environments
|
|
5
|
+
Home-page: https://github.com/Ierofantis/streaming_sql_engine/
|
|
6
|
+
Author: Ierofantis
|
|
7
|
+
Author-email: Ierofantis <teopanta1986@gmail.com>
|
|
8
|
+
Project-URL: Homepage, https://github.com/Ierofantis/streaming_sql_engine/
|
|
9
|
+
Project-URL: Repository, https://github.com/Ierofantis/streaming_sql_engine/
|
|
10
|
+
Project-URL: Issues, https://github.com/Ierofantis/streaming_sql_engine/issues
|
|
11
|
+
Project-URL: Documentation, https://github.com/Ierofantis/streaming_sql_engine/blob/master/README.md
|
|
12
|
+
Project-URL: Scientific-Paper, https://github.com/Ierofantis/streaming_sql_engine/blob/master/Streaming_SQL_Engine_Paper.pdf
|
|
13
|
+
Keywords: sql,streaming,join,database,query,engine,etl,data-integration
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Database
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
Requires-Dist: sqlglot>=23.0.0
|
|
28
|
+
Requires-Dist: polars>=0.19.0
|
|
29
|
+
Provides-Extra: db
|
|
30
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "db"
|
|
31
|
+
Requires-Dist: pymysql>=1.0.0; extra == "db"
|
|
32
|
+
Requires-Dist: DBUtils>=3.0.0; extra == "db"
|
|
33
|
+
Requires-Dist: pymongo>=4.0.0; extra == "db"
|
|
34
|
+
Provides-Extra: app
|
|
35
|
+
Requires-Dist: fastapi>=0.100.0; extra == "app"
|
|
36
|
+
Requires-Dist: uvicorn>=0.23.0; extra == "app"
|
|
37
|
+
Requires-Dist: psutil>=5.9.0; extra == "app"
|
|
38
|
+
Requires-Dist: openpyxl>=3.1.0; extra == "app"
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
44
|
+
Provides-Extra: all
|
|
45
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
|
|
46
|
+
Requires-Dist: pymysql>=1.0.0; extra == "all"
|
|
47
|
+
Requires-Dist: DBUtils>=3.0.0; extra == "all"
|
|
48
|
+
Requires-Dist: pymongo>=4.0.0; extra == "all"
|
|
49
|
+
Dynamic: author
|
|
50
|
+
Dynamic: home-page
|
|
51
|
+
Dynamic: requires-python
|
|
52
|
+
|
|
1
53
|
# Streaming SQL Engine: Join Data from Anywhere
|
|
2
54
|
|
|
3
55
|
Join data from MySQL, PostgreSQL, MongoDB, REST APIs, CSV files, and more — all in one SQL query, without infrastructure or data import.
|
|
@@ -69,7 +121,7 @@ for row in engine.query(query):
|
|
|
69
121
|
|
|
70
122
|
## File Compare app
|
|
71
123
|
|
|
72
|
-
A local web app on top of the engine: compare two large CSV, TSV, JSONL or Excel files and watch the join run live. Nothing is uploaded; it runs on your machine and opens in your browser.
|
|
124
|
+
A local web app on top of the engine: compare two or more large CSV, TSV, JSONL or Excel files by a key and watch the join run live. Nothing is uploaded; it runs on your machine and opens in your browser.
|
|
73
125
|
|
|
74
126
|
```bash
|
|
75
127
|
pip install "streaming-sql-engine[app]"
|
|
@@ -78,11 +130,31 @@ sse-compare # or: python -m streaming_sql_engine.app
|
|
|
78
130
|
|
|
79
131
|
From a source checkout: `python run_app.py`.
|
|
80
132
|
|
|
81
|
-
|
|
133
|
+

|
|
134
|
+
|
|
135
|
+
While a comparison runs, the counters, charts and result rows update live:
|
|
136
|
+
|
|
137
|
+

|
|
138
|
+
|
|
139
|
+
1. Pick file A and file B (or generate synthetic demo files). "Add another file" adds file C, D and so on, up to twelve.
|
|
82
140
|
2. Confirm the key columns; the app suggests them from column names and sample values.
|
|
83
|
-
3. Choose what to show: rows in
|
|
141
|
+
3. Choose what to show: rows in all files, rows only in one of them, or matched rows whose values differ.
|
|
84
142
|
4. Press Run. Rows, throughput and memory update live, the generated SQL is shown, and the result downloads as CSV.
|
|
85
143
|
|
|
144
|
+
### More than two files
|
|
145
|
+
|
|
146
|
+
Every other file is matched against file A on its own key column.
|
|
147
|
+
|
|
148
|
+
- **Rows in all files:** the key is present in every file. The result has the columns of all of them.
|
|
149
|
+
- **Rows only in C** (or any other file): rows of that file whose key is in none of the others.
|
|
150
|
+
- **Matched rows whose values differ:** rows present in every file where a column of A differs from the column you paired it with in another file. Each pair names its file.
|
|
151
|
+
|
|
152
|
+
The comparison runs as one join per extra file: A with B, the result with C, and so on. The page shows which step is running. Every join strategy works this way except the DuckDB comparison, which is set up for two files.
|
|
153
|
+
|
|
154
|
+

|
|
155
|
+
|
|
156
|
+
### Join strategies
|
|
157
|
+
|
|
86
158
|
The "File index in Rust" strategy (files in any order) and the "Merge in Rust" strategies (files already sorted by the key) use an optional native extension that runs on all cores. It reads CSV and TSV. Build it once from a checkout (needs the Rust toolchain):
|
|
87
159
|
|
|
88
160
|
```bash
|
|
@@ -90,8 +162,59 @@ pip install maturin
|
|
|
90
162
|
cd native && maturin develop --release
|
|
91
163
|
```
|
|
92
164
|
|
|
165
|
+
How the Rust code works, step by step: [docs/rust-kernels.md](docs/rust-kernels.md).
|
|
166
|
+
|
|
93
167
|
Each run happens in its own process, so the memory figure is the cost of that run alone. Run the same comparison with the "In-memory hash" strategy to see the difference against the default file index join.
|
|
94
168
|
|
|
169
|
+
"DuckDB (for comparison)" runs the same comparison in DuckDB if it is installed (`pip install duckdb`), so you can put its time and memory next to the engine's own in the runs table.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Benchmark: Python, Rust and DuckDB
|
|
174
|
+
|
|
175
|
+
The job: read two CSV files of 5 million rows, join them on a key, write the result (4.8 million rows) as CSV.
|
|
176
|
+
|
|
177
|
+

|
|
178
|
+
|
|
179
|
+
Both files sorted by the key, 503 MB of input:
|
|
180
|
+
|
|
181
|
+
| Engine | Time | Peak memory |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| Python, file index join | 129 s | 194 MB |
|
|
184
|
+
| Python, in-memory hash join | 134 s | 4,089 MB |
|
|
185
|
+
| Python, merge join | 122 s | 68 MB |
|
|
186
|
+
| **Rust, file index join** | **1.6 s** | **95 MB** |
|
|
187
|
+
| **Rust, merge join** | **1.5 s** | **52 MB** |
|
|
188
|
+
| DuckDB 2.0.1 | 4.4 s | 1,208 MB |
|
|
189
|
+
|
|
190
|
+
Rust file index join against DuckDB on other data shapes (median of 5 runs):
|
|
191
|
+
|
|
192
|
+
| Data shape | Rust time | DuckDB time | Rust memory | DuckDB memory |
|
|
193
|
+
|---|---|---|---|---|
|
|
194
|
+
| File B shuffled | 2.4 s | 5.7 s | 99 MB | 1,254 MB |
|
|
195
|
+
| Both files shuffled | 2.1 s | 5.1 s | 97 MB | 1,280 MB |
|
|
196
|
+
| Both files sorted | 1.7 s | 4.2 s | 98 MB | 1,275 MB |
|
|
197
|
+
| Wide rows (2.4 GB input) | 9.6 s | 8.1 s | 106 MB | 2,301 MB |
|
|
198
|
+
| Repeated keys in B | 2.0 s | 4.7 s | 164 MB | 1,305 MB |
|
|
199
|
+
| Only 10% of rows match | 1.0 s | 2.7 s | 82 MB | 1,265 MB |
|
|
200
|
+
|
|
201
|
+
How to read this:
|
|
202
|
+
|
|
203
|
+
- **Machine:** a laptop with 4 physical / 8 logical cores and 32 GB RAM, Windows 11, Python 3.14. Rust and DuckDB use all 8 threads; the Python joins use one.
|
|
204
|
+
- **Method:** every run is a fresh process, the input files are already in the operating system's file cache, runs are interleaved, and the engines must produce the same result (row count, plus a checksum of the output for Rust and DuckDB). The Python joins were run once each; everything else is a median of 3 or 5 runs.
|
|
205
|
+
- **DuckDB reads the columns as text** here, as this engine does. With its own type detection it was up to 16% faster and used 6–26% less memory.
|
|
206
|
+
- **This is one job, not a general comparison.** DuckDB is a full analytical database; the Rust kernels do a two-file equality join on one key and copy bytes from input to output. On wide rows DuckDB is faster.
|
|
207
|
+
- **Not measured:** files larger than RAM, and machines with more cores.
|
|
208
|
+
|
|
209
|
+
Reproduce it (needs `duckdb`, `psutil` and the Rust extension):
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
python benchmarks/bench_vs_duckdb.py --rows 5000000 # Rust and DuckDB, six data shapes
|
|
213
|
+
python benchmarks/bench_vs_duckdb.py --rows 5000000 --python --shapes shuffled,sorted
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Full reports: [Rust and DuckDB](benchmarks/results/rust-vs-duckdb-5m.md), [with the Python joins](benchmarks/results/python-rust-duckdb-5m.md).
|
|
217
|
+
|
|
95
218
|
---
|
|
96
219
|
|
|
97
220
|
## The Problem: Data Lives Everywhere
|