streaming-sql-engine 0.1.1__tar.gz → 0.1.3__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.1.1/streaming_sql_engine.egg-info → streaming_sql_engine-0.1.3}/PKG-INFO +55 -82
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/README.md +275 -307
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/__init__.py +1 -1
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/db_connector.py +30 -6
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/API_JOIN_OPERATIONS.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/BEST_USE_CASES.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/COMPREHENSIVE_DOCUMENTATION.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/DEVELOPER_GUIDE.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/DUCKDB_COMPARISON.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/HOW_TO_ADD_TO_PROJECT.md +2 -3
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/INSTALLATION.md +2 -3
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/MULTI_SOURCE_EXAMPLE_README.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/MYSQL_USAGE.md +1 -2
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/PERFORMANCE.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/QUICK_START.md +0 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/TECHNICAL_DOCUMENTATION.md +0 -1
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/engine.py +119 -109
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/evaluator.py +218 -218
- streaming_sql_engine-0.1.3/executor.py +318 -0
- streaming_sql_engine-0.1.3/mmap_index.py +386 -0
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/operators.py +507 -479
- streaming_sql_engine-0.1.3/operators_mmap.py +269 -0
- streaming_sql_engine-0.1.3/operators_polars.py +581 -0
- streaming_sql_engine-0.1.3/optimizer.py +349 -0
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/planner.py +172 -156
- streaming_sql_engine-0.1.3/polars_expression_translator.py +177 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/pyproject.toml +12 -10
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/requirements.txt +1 -1
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/setup.py +10 -9
- streaming_sql_engine-0.1.3/streaming_sql_engine/__init__.py +36 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/db_connector.py +594 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/engine.py +119 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/evaluator.py +218 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/executor.py +318 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/jsonl_executor.py +393 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/operators.py +507 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/parser.py +93 -0
- streaming_sql_engine-0.1.3/streaming_sql_engine/planner.py +172 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3/streaming_sql_engine.egg-info}/PKG-INFO +55 -82
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/streaming_sql_engine.egg-info/SOURCES.txt +28 -2
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/streaming_sql_engine.egg-info/requires.txt +6 -0
- streaming_sql_engine-0.1.1/LICENSE +0 -22
- streaming_sql_engine-0.1.1/MANIFEST.in +0 -13
- streaming_sql_engine-0.1.1/streaming_sql_engine/executor.py +0 -133
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/APACHE_DRILL_COMPARISON.md +0 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/documentation/USER_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/jsonl_executor.py +0 -0
- {streaming_sql_engine-0.1.1/streaming_sql_engine → streaming_sql_engine-0.1.3}/parser.py +0 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/setup.cfg +0 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/streaming_sql_engine.egg-info/dependency_links.txt +0 -0
- {streaming_sql_engine-0.1.1 → streaming_sql_engine-0.1.3}/streaming_sql_engine.egg-info/top_level.txt +0 -0
{streaming_sql_engine-0.1.1/streaming_sql_engine.egg-info → streaming_sql_engine-0.1.3}/PKG-INFO
RENAMED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streaming-sql-engine
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: A lightweight SQL execution engine for streaming row-by-row queries with joins
|
|
5
|
-
Home-page: https://github.com/Ierofantis/streaming-sql-engine
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
8
|
-
|
|
9
|
-
Project-URL:
|
|
5
|
+
Home-page: https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
6
|
+
Author: Your Name
|
|
7
|
+
Author-email: Your Name <your.email@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
10
|
+
Project-URL: Repository, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
10
11
|
Project-URL: Issues, https://github.com/Ierofantis/streaming-sql-engine/issues
|
|
11
|
-
Project-URL: Documentation, https://github.com/Ierofantis/streaming-sql-engine
|
|
12
|
+
Project-URL: Documentation, https://github.com/Ierofantis/streaming-sql-engine/tree/master#readme
|
|
12
13
|
Keywords: sql,streaming,join,database,query,engine
|
|
13
14
|
Classifier: Development Status :: 3 - Alpha
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -34,6 +35,10 @@ Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
|
34
35
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
35
36
|
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
36
37
|
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
38
|
+
Provides-Extra: mongodb
|
|
39
|
+
Requires-Dist: pymongo>=4.0.0; extra == "mongodb"
|
|
40
|
+
Provides-Extra: polars
|
|
41
|
+
Requires-Dist: polars>=0.19.0; extra == "polars"
|
|
37
42
|
Dynamic: author
|
|
38
43
|
Dynamic: home-page
|
|
39
44
|
Dynamic: requires-python
|
|
@@ -90,7 +95,7 @@ from streaming_sql_engine import Engine
|
|
|
90
95
|
If the library is hosted on GitHub or another Git repository:
|
|
91
96
|
|
|
92
97
|
```bash
|
|
93
|
-
pip install git+https://github.com/
|
|
98
|
+
pip install git+https://github.com/yourusername/streaming-sql-engine.git
|
|
94
99
|
```
|
|
95
100
|
|
|
96
101
|
### Option 4: Install as a Package in Your Project
|
|
@@ -185,73 +190,6 @@ for row in engine.query(query):
|
|
|
185
190
|
# {'name': 'Charlie', 'dept_name': 'Engineering'}
|
|
186
191
|
```
|
|
187
192
|
|
|
188
|
-
## Real-World Example: Joining Multiple APIs
|
|
189
|
-
|
|
190
|
-
Join data from multiple free public APIs using SQL:
|
|
191
|
-
|
|
192
|
-
```python
|
|
193
|
-
# Install: pip install streaming-sql-engine
|
|
194
|
-
import requests
|
|
195
|
-
from streaming_sql_engine import Engine
|
|
196
|
-
|
|
197
|
-
# Define API sources
|
|
198
|
-
def jsonplaceholder_users_api():
|
|
199
|
-
"""Fetch users from JSONPlaceholder API."""
|
|
200
|
-
response = requests.get("https://jsonplaceholder.typicode.com/users")
|
|
201
|
-
for user in response.json():
|
|
202
|
-
yield {
|
|
203
|
-
"user_id": user["id"],
|
|
204
|
-
"user_name": user["name"],
|
|
205
|
-
"user_email": user["email"],
|
|
206
|
-
"user_city": user["address"]["city"],
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
def jsonplaceholder_posts_api():
|
|
210
|
-
"""Fetch posts from JSONPlaceholder API."""
|
|
211
|
-
response = requests.get("https://jsonplaceholder.typicode.com/posts")
|
|
212
|
-
for post in response.json():
|
|
213
|
-
yield {
|
|
214
|
-
"post_id": post["id"],
|
|
215
|
-
"user_id": post["userId"],
|
|
216
|
-
"post_title": post["title"],
|
|
217
|
-
"post_body": post["body"][:100],
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
def rest_countries_api():
|
|
221
|
-
"""Fetch countries from REST Countries API."""
|
|
222
|
-
response = requests.get("https://restcountries.com/v3.1/all")
|
|
223
|
-
for country in response.json():
|
|
224
|
-
yield {
|
|
225
|
-
"country_code": country.get("cca2", ""),
|
|
226
|
-
"country_name": country["name"].get("common", ""),
|
|
227
|
-
"capital": country.get("capital", ["N/A"])[0] if country.get("capital") else "N/A",
|
|
228
|
-
"population": country.get("population", 0),
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
# Create engine and register sources
|
|
232
|
-
engine = Engine()
|
|
233
|
-
engine.register("users", jsonplaceholder_users_api)
|
|
234
|
-
engine.register("posts", jsonplaceholder_posts_api)
|
|
235
|
-
engine.register("countries", rest_countries_api)
|
|
236
|
-
|
|
237
|
-
# Join Users + Posts from different APIs
|
|
238
|
-
query = """
|
|
239
|
-
SELECT
|
|
240
|
-
users.user_name,
|
|
241
|
-
users.user_email,
|
|
242
|
-
posts.post_title,
|
|
243
|
-
posts.post_body
|
|
244
|
-
FROM users
|
|
245
|
-
JOIN posts ON users.user_id = posts.user_id
|
|
246
|
-
WHERE users.user_id <= 3
|
|
247
|
-
"""
|
|
248
|
-
|
|
249
|
-
for row in engine.query(query):
|
|
250
|
-
print(f"{row['user_name']} ({row['user_email']}): {row['post_title']}")
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
This example demonstrates joining data from multiple REST APIs using standard SQL syntax - no ETL, no data copying, just pure SQL joins across different data sources!
|
|
254
|
-
|
|
255
193
|
## Supported SQL Features
|
|
256
194
|
|
|
257
195
|
### SELECT
|
|
@@ -305,6 +243,40 @@ engine.register(
|
|
|
305
243
|
)
|
|
306
244
|
```
|
|
307
245
|
|
|
246
|
+
## Performance Optimizations
|
|
247
|
+
|
|
248
|
+
### Memory-Efficient Joins
|
|
249
|
+
|
|
250
|
+
For file-based sources, use `filename` parameter to enable memory-mapped joins (90-99% memory reduction):
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
engine.register(
|
|
254
|
+
"images",
|
|
255
|
+
lambda: load_jsonl_file("images.jsonl"),
|
|
256
|
+
filename="images.jsonl" # Enables mmap-based joins
|
|
257
|
+
)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Database Filter Pushdown
|
|
261
|
+
|
|
262
|
+
For database sources, use `is_database_source=True` to enable filter pushdown:
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
engine.register(
|
|
266
|
+
"products",
|
|
267
|
+
create_table_source(pool, "products"),
|
|
268
|
+
is_database_source=True # Enables WHERE clause pushdown
|
|
269
|
+
)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Polars Acceleration
|
|
273
|
+
|
|
274
|
+
Polars optimizations are enabled by default. Disable with:
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
engine = Engine(use_polars=False) # Disable Polars optimizations
|
|
278
|
+
```
|
|
279
|
+
|
|
308
280
|
## Architecture
|
|
309
281
|
|
|
310
282
|
The engine follows a pipeline architecture:
|
|
@@ -334,14 +306,15 @@ The engine raises clear exceptions for:
|
|
|
334
306
|
- **Streaming**: Results are yielded as soon as they're produced
|
|
335
307
|
- **No buffering**: Intermediate results are not fully materialized
|
|
336
308
|
|
|
337
|
-
##
|
|
338
|
-
|
|
339
|
-
Once published, you can install the package directly from PyPI:
|
|
309
|
+
## Documentation
|
|
340
310
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
311
|
+
- **[TECHNICAL_DOCUMENTATION.md](TECHNICAL_DOCUMENTATION.md)**: Complete technical documentation explaining architecture, algorithms, and design decisions
|
|
312
|
+
- **[DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)**: Guide for developers who want to understand, modify, or extend the codebase
|
|
313
|
+
- **[PERFORMANCE.md](PERFORMANCE.md)**: Performance comparison with database joins and optimization tips
|
|
314
|
+
- **[MYSQL_USAGE.md](MYSQL_USAGE.md)**: MySQL-specific usage guide
|
|
315
|
+
- **[QUICK_START.md](QUICK_START.md)**: Quick start guide for new users
|
|
316
|
+
- **[INSTALLATION.md](INSTALLATION.md)**: Detailed installation instructions
|
|
344
317
|
|
|
345
318
|
## License
|
|
346
319
|
|
|
347
|
-
MIT
|
|
320
|
+
MIT
|