streaming-sql-engine 0.1.4__tar.gz → 0.1.6__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.6/DEPLOYMENT.md +154 -0
- {streaming_sql_engine-0.1.4/streaming_sql_engine.egg-info → streaming_sql_engine-0.1.6}/PKG-INFO +1 -2
- streaming_sql_engine-0.1.6/QUICK_DEPLOY.md +82 -0
- streaming_sql_engine-0.1.6/QUICK_FIX.md +53 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/__init__.py +1 -1
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZER_AUTOMATED.md +13 -1
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SIMPLE_PROTOCOL_GUIDE.md +23 -3
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SIMPLE_SOURCE_FUNCTIONS.md +8 -5
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHAT_IS_WHERE_TO_PARAMS.md +11 -4
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_API_CONVERTER_NEEDED.md +9 -1
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_MANUAL_PARSING.md +5 -2
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_PROTOCOL_IN_SOURCES.md +14 -3
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/executor.py +3 -2
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/pyproject.toml +8 -2
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/setup.py +1 -2
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6/streaming_sql_engine.egg-info}/PKG-INFO +1 -2
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/SOURCES.txt +8 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/MANIFEST.in +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/README.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/APACHE_DRILL_COMPARISON.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/API_JOIN_OPERATIONS.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/ARCHITECTURAL_RECOMMENDATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/ARCHITECTURE_DECISION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/ARCHITECTURE_SYNCED.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/BEST_USE_CASES.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/BETTER_FILTER_APPROACH.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/CHANGES_SUMMARY.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/COMPREHENSIVE_DOCUMENTATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/DEVELOPER_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/DUCKDB_COMPARISON.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/FINAL_IMPLEMENTATION_RECOMMENDATIONS.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/FINAL_RECOMMENDATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/HOW_PROTOCOL_DETECTION_WORKS.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/HOW_TO_ADD_TO_PROJECT.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/INSTALLATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/JSONL_EXECUTOR_ANALYSIS.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/JSONL_EXECUTOR_REMOVED.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/LIBRARY_DOCUMENTATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/MIGRATION_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/MULTI_SOURCE_EXAMPLE_README.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/MYSQL_USAGE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZATIONS_BREAKDOWN.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZATIONS_NOT_DATABASE_ONLY.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZATIONS_VS_POLARS.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PERFORMANCE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PERFORMANCE_COMPARISON.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/POLARS_AND_MMAP_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PROTOCOL_AND_OPTIMIZATIONS_EXPLAINED.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PROTOCOL_EXPLANATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PUBLISHING.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PYPI_CHECKLIST.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/QUICK_PUBLISH.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/QUICK_START.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SOURCE_COMBINATIONS_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/TECHNICAL_DOCUMENTATION.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/USER_GUIDE.md +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/engine.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/evaluator.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/mmap_index.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/operators.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/operators_mmap.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/operators_polars.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/optimizer.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/parser.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/planner.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/polars_expression_translator.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/polars_operators.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/protocol_helpers.py +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/requirements.txt +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/setup.cfg +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/dependency_links.txt +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/requires.txt +0 -0
- {streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Deploying to PyPI
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
1. **PyPI Account**: Create an account at https://pypi.org/account/register/
|
|
6
|
+
2. **TestPyPI Account** (optional, for testing): https://test.pypi.org/account/register/
|
|
7
|
+
3. **Install build tools**:
|
|
8
|
+
```bash
|
|
9
|
+
pip install build twine
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Step 1: Update Version
|
|
13
|
+
|
|
14
|
+
Before deploying, update the version in:
|
|
15
|
+
- `pyproject.toml` (version field)
|
|
16
|
+
- `setup.py` (version field)
|
|
17
|
+
- `__init__.py` (__version__ variable)
|
|
18
|
+
|
|
19
|
+
Current version: **0.1.4**
|
|
20
|
+
|
|
21
|
+
## Step 2: Clean Previous Builds
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Remove old build artifacts
|
|
25
|
+
rm -rf build/
|
|
26
|
+
rm -rf dist/
|
|
27
|
+
rm -rf *.egg-info
|
|
28
|
+
rm -rf streaming_sql_engine.egg-info/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Step 3: Build the Package
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Build source distribution and wheel
|
|
35
|
+
python -m build
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This creates:
|
|
39
|
+
- `dist/streaming-sql-engine-0.1.4.tar.gz` (source distribution)
|
|
40
|
+
- `dist/streaming-sql-engine-0.1.4-py3-none-any.whl` (wheel)
|
|
41
|
+
|
|
42
|
+
## Step 4: Test the Build (Optional but Recommended)
|
|
43
|
+
|
|
44
|
+
### Test on TestPyPI first:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Upload to TestPyPI
|
|
48
|
+
python -m twine upload --repository testpypi dist/*
|
|
49
|
+
|
|
50
|
+
# Test installation from TestPyPI
|
|
51
|
+
pip install --index-url https://test.pypi.org/simple/ streaming-sql-engine
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Test locally:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Install from local build
|
|
58
|
+
pip install dist/streaming-sql-engine-0.1.4-py3-none-any.whl
|
|
59
|
+
|
|
60
|
+
# Test import
|
|
61
|
+
python -c "from streaming_sql_engine import Engine; print('✅ Import successful!')"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Step 5: Upload to PyPI
|
|
65
|
+
|
|
66
|
+
### Option A: Upload to TestPyPI First (Recommended)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Upload to TestPyPI
|
|
70
|
+
python -m twine upload --repository testpypi dist/*
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
You'll be prompted for:
|
|
74
|
+
- Username: Your PyPI username
|
|
75
|
+
- Password: Your PyPI password (or API token)
|
|
76
|
+
|
|
77
|
+
### Option B: Upload Directly to PyPI
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Upload to PyPI
|
|
81
|
+
python -m twine upload dist/*
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Step 6: Verify Installation
|
|
85
|
+
|
|
86
|
+
After uploading, wait a few minutes for PyPI to process, then test:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Install from PyPI
|
|
90
|
+
pip install streaming-sql-engine
|
|
91
|
+
|
|
92
|
+
# Or with optional dependencies
|
|
93
|
+
pip install streaming-sql-engine[polars]
|
|
94
|
+
pip install streaming-sql-engine[db]
|
|
95
|
+
pip install streaming-sql-engine[all]
|
|
96
|
+
|
|
97
|
+
# Test import
|
|
98
|
+
python -c "from streaming_sql_engine import Engine, register_file_source; print('✅ Import successful!')"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Using API Tokens (More Secure)
|
|
102
|
+
|
|
103
|
+
Instead of using your password, create an API token:
|
|
104
|
+
|
|
105
|
+
1. Go to https://pypi.org/manage/account/
|
|
106
|
+
2. Scroll to "API tokens"
|
|
107
|
+
3. Create a new token with scope "Entire account" or specific project
|
|
108
|
+
4. Use the token as username: `__token__` and password: `pypi-...` (the token)
|
|
109
|
+
|
|
110
|
+
## Troubleshooting
|
|
111
|
+
|
|
112
|
+
### "Package already exists"
|
|
113
|
+
- Increment version number in `pyproject.toml`, `setup.py`, and `__init__.py`
|
|
114
|
+
|
|
115
|
+
### "Invalid distribution"
|
|
116
|
+
- Make sure all required files are included
|
|
117
|
+
- Check `MANIFEST.in` includes necessary files
|
|
118
|
+
- Verify `pyproject.toml` is valid
|
|
119
|
+
|
|
120
|
+
### "Module not found" after installation
|
|
121
|
+
- Check `package_dir` in `setup.py` matches your structure
|
|
122
|
+
- Verify `__init__.py` is in the correct location
|
|
123
|
+
- Check that all Python files are included
|
|
124
|
+
|
|
125
|
+
## Quick Deploy Script
|
|
126
|
+
|
|
127
|
+
Create a `deploy.sh` script:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
#!/bin/bash
|
|
131
|
+
set -e
|
|
132
|
+
|
|
133
|
+
echo "🧹 Cleaning old builds..."
|
|
134
|
+
rm -rf build/ dist/ *.egg-info streaming_sql_engine.egg-info/
|
|
135
|
+
|
|
136
|
+
echo "📦 Building package..."
|
|
137
|
+
python -m build
|
|
138
|
+
|
|
139
|
+
echo "📤 Uploading to PyPI..."
|
|
140
|
+
python -m twine upload dist/*
|
|
141
|
+
|
|
142
|
+
echo "✅ Deployment complete!"
|
|
143
|
+
echo "Test with: pip install streaming-sql-engine"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Make it executable: `chmod +x deploy.sh`
|
|
147
|
+
|
|
148
|
+
## Version History
|
|
149
|
+
|
|
150
|
+
- **0.1.4** - Current version with protocol helpers and WHERE clause pushdown to joined tables
|
|
151
|
+
- **0.1.3** - Previous version
|
|
152
|
+
- **0.1.2** - Previous version
|
|
153
|
+
- **0.1.0** - Initial release
|
|
154
|
+
|
{streaming_sql_engine-0.1.4/streaming_sql_engine.egg-info → streaming_sql_engine-0.1.6}/PKG-INFO
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streaming-sql-engine
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources
|
|
5
5
|
Home-page: https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
6
6
|
Author: Theodore Pantazopoulo
|
|
7
7
|
Author-email: Theodore Pantazopoulo <your.email@example.com>
|
|
8
|
-
License: MIT
|
|
9
8
|
Project-URL: Homepage, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
10
9
|
Project-URL: Repository, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
11
10
|
Project-URL: Issues, https://github.com/Ierofantis/streaming-sql-engine/issues
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Quick PyPI Deployment Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
Install build tools:
|
|
6
|
+
```bash
|
|
7
|
+
pip install build twine
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Step 1: Build the Package
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Clean old builds
|
|
14
|
+
rmdir /s /q build dist *.egg-info streaming_sql_engine.egg-info 2>nul
|
|
15
|
+
|
|
16
|
+
# Build package
|
|
17
|
+
python -m build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This creates:
|
|
21
|
+
- `dist/streaming-sql-engine-0.1.4.tar.gz`
|
|
22
|
+
- `dist/streaming-sql-engine-0.1.4-py3-none-any.whl`
|
|
23
|
+
|
|
24
|
+
## Step 2: Upload to PyPI
|
|
25
|
+
|
|
26
|
+
### Option A: Test on TestPyPI First (Recommended)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m twine upload --repository testpypi dist/*
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then test installation:
|
|
33
|
+
```bash
|
|
34
|
+
pip install --index-url https://test.pypi.org/simple/ streaming-sql-engine
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Option B: Upload to PyPI
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python -m twine upload dist/*
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
You'll be prompted for:
|
|
44
|
+
- **Username**: Your PyPI username (or `__token__` for API token)
|
|
45
|
+
- **Password**: Your PyPI password (or API token starting with `pypi-`)
|
|
46
|
+
|
|
47
|
+
## Step 3: Verify Installation
|
|
48
|
+
|
|
49
|
+
Wait a few minutes, then test:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install streaming-sql-engine
|
|
53
|
+
|
|
54
|
+
# Or with optional dependencies
|
|
55
|
+
pip install streaming-sql-engine[polars]
|
|
56
|
+
pip install streaming-sql-engine[db]
|
|
57
|
+
pip install streaming-sql-engine[all]
|
|
58
|
+
|
|
59
|
+
# Test import
|
|
60
|
+
python -c "from streaming_sql_engine import Engine, register_file_source; print('✅ Success!')"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Using API Tokens (More Secure)
|
|
64
|
+
|
|
65
|
+
1. Go to https://pypi.org/manage/account/
|
|
66
|
+
2. Create API token
|
|
67
|
+
3. Use username: `__token__` and password: `pypi-...` (your token)
|
|
68
|
+
|
|
69
|
+
## Current Version: 0.1.4
|
|
70
|
+
|
|
71
|
+
Updated files:
|
|
72
|
+
- ✅ `pyproject.toml` - version 0.1.4
|
|
73
|
+
- ✅ `setup.py` - version 0.1.4
|
|
74
|
+
- ✅ `__init__.py` - version 0.1.4
|
|
75
|
+
|
|
76
|
+
## What's New in 0.1.4
|
|
77
|
+
|
|
78
|
+
- Protocol helpers for automatic filter pushdown and column pruning
|
|
79
|
+
- WHERE clause pushdown to joined tables
|
|
80
|
+
- Improved performance with optimized protocol detection
|
|
81
|
+
- Better error handling and debugging
|
|
82
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Quick Fix for join_required_columns Bug
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
The installed version from PyPI (0.1.4) has a bug where `join_required_columns` is assigned inside an `if debug:` block but used outside, causing `UnboundLocalError` when `debug=False`.
|
|
5
|
+
|
|
6
|
+
## Solution 1: Patch Installed Version (Quick Fix)
|
|
7
|
+
|
|
8
|
+
Run this on your server:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Download the patch script
|
|
12
|
+
# Or copy examples/patch_executor.py to your server
|
|
13
|
+
|
|
14
|
+
# Run the patch
|
|
15
|
+
python3 patch_executor.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This will automatically fix the installed version.
|
|
19
|
+
|
|
20
|
+
## Solution 2: Update Package (Recommended)
|
|
21
|
+
|
|
22
|
+
Update to version 0.1.5 which has the fix:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install --upgrade streaming-sql-engine==0.1.5
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Solution 3: Manual Patch
|
|
29
|
+
|
|
30
|
+
If the automatic patch doesn't work, manually edit:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Find the installed package
|
|
34
|
+
python3 -c "import streaming_sql_engine; print(streaming_sql_engine.__file__)"
|
|
35
|
+
|
|
36
|
+
# Edit the executor.py file
|
|
37
|
+
# Change line ~128-130 from:
|
|
38
|
+
# if debug:
|
|
39
|
+
# # Get required columns for joined table
|
|
40
|
+
# join_required_columns = plan.required_columns.get(join_info.table)
|
|
41
|
+
#
|
|
42
|
+
# To:
|
|
43
|
+
# # Get required columns for joined table (must be outside debug block!)
|
|
44
|
+
# join_required_columns = plan.required_columns.get(join_info.table)
|
|
45
|
+
#
|
|
46
|
+
# if debug:
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## What Was Fixed
|
|
50
|
+
|
|
51
|
+
- Moved `join_required_columns` assignment outside the `debug` block
|
|
52
|
+
- Fixed reconciliation script bug with `spryker_id_int` reference
|
|
53
|
+
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZER_AUTOMATED.md
RENAMED
|
@@ -25,6 +25,7 @@ executor.py: Uses optimizations automatically
|
|
|
25
25
|
### 2. Code Evidence
|
|
26
26
|
|
|
27
27
|
**In `planner.py` (lines 83-92):**
|
|
28
|
+
|
|
28
29
|
```python
|
|
29
30
|
# Build initial plan
|
|
30
31
|
plan = LogicalPlan(...)
|
|
@@ -44,12 +45,14 @@ return plan
|
|
|
44
45
|
```
|
|
45
46
|
|
|
46
47
|
**In `engine.py` (line 109):**
|
|
48
|
+
|
|
47
49
|
```python
|
|
48
50
|
# Build logical plan (optimizer runs automatically inside)
|
|
49
51
|
logical_plan = build_logical_plan(ast, self._sources.keys())
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
**In `executor.py` (lines 55-104):**
|
|
55
|
+
|
|
53
56
|
```python
|
|
54
57
|
# Uses optimizations automatically
|
|
55
58
|
root_required_columns = plan.required_columns.get(plan.root_table)
|
|
@@ -68,16 +71,19 @@ if source_supports_optimizations(root_source_fn):
|
|
|
68
71
|
### 1. Column Pruning (Automatic)
|
|
69
72
|
|
|
70
73
|
**What it does:**
|
|
74
|
+
|
|
71
75
|
- Analyzes SELECT, WHERE, and JOIN clauses
|
|
72
76
|
- Determines which columns are actually needed from each table
|
|
73
77
|
- Adds `required_columns` to the plan
|
|
74
78
|
|
|
75
79
|
**Example:**
|
|
80
|
+
|
|
76
81
|
```sql
|
|
77
82
|
SELECT users.name FROM users JOIN orders ON users.id = orders.user_id
|
|
78
83
|
```
|
|
79
84
|
|
|
80
85
|
**Optimizer automatically determines:**
|
|
86
|
+
|
|
81
87
|
- `users` needs: `name`, `id` (for join)
|
|
82
88
|
- `orders` needs: `user_id` (for join)
|
|
83
89
|
|
|
@@ -86,17 +92,20 @@ SELECT users.name FROM users JOIN orders ON users.id = orders.user_id
|
|
|
86
92
|
### 2. Filter Pushdown (Automatic)
|
|
87
93
|
|
|
88
94
|
**What it does:**
|
|
95
|
+
|
|
89
96
|
- Analyzes WHERE clause
|
|
90
97
|
- Identifies conditions that only reference root table
|
|
91
98
|
- Splits into pushable vs non-pushable conditions
|
|
92
99
|
|
|
93
100
|
**Example:**
|
|
101
|
+
|
|
94
102
|
```sql
|
|
95
103
|
SELECT * FROM users JOIN orders ON users.id = orders.user_id
|
|
96
104
|
WHERE users.age > 30 AND orders.total > 100
|
|
97
105
|
```
|
|
98
106
|
|
|
99
107
|
**Optimizer automatically determines:**
|
|
108
|
+
|
|
100
109
|
- Pushable: `users.age > 30` (only references root table)
|
|
101
110
|
- Non-pushable: `orders.total > 100` (references joined table)
|
|
102
111
|
|
|
@@ -105,6 +114,7 @@ WHERE users.age > 30 AND orders.total > 100
|
|
|
105
114
|
## Protocol Detection (Also Automatic)
|
|
106
115
|
|
|
107
116
|
**In `executor.py` (lines 80-88):**
|
|
117
|
+
|
|
108
118
|
```python
|
|
109
119
|
def source_supports_optimizations(source_fn):
|
|
110
120
|
"""Check if source implements optimization protocol."""
|
|
@@ -117,6 +127,7 @@ def source_supports_optimizations(source_fn):
|
|
|
117
127
|
```
|
|
118
128
|
|
|
119
129
|
**What this means:**
|
|
130
|
+
|
|
120
131
|
- Engine automatically detects if source supports protocol
|
|
121
132
|
- If yes → optimizations are applied automatically
|
|
122
133
|
- If no → works normally, no optimizations
|
|
@@ -132,12 +143,14 @@ def source_supports_optimizations(source_fn):
|
|
|
132
143
|
## No Manual Configuration Needed!
|
|
133
144
|
|
|
134
145
|
**You don't need to:**
|
|
146
|
+
|
|
135
147
|
- ❌ Call optimizer manually
|
|
136
148
|
- ❌ Configure optimization settings
|
|
137
149
|
- ❌ Enable optimizations
|
|
138
150
|
- ❌ Set flags or parameters
|
|
139
151
|
|
|
140
152
|
**You just:**
|
|
153
|
+
|
|
141
154
|
- ✅ Write SQL query
|
|
142
155
|
- ✅ Register sources (with protocol if you want optimizations)
|
|
143
156
|
- ✅ Execute query
|
|
@@ -172,4 +185,3 @@ for row in engine.query("SELECT users.name FROM users WHERE users.age > 30"):
|
|
|
172
185
|
```
|
|
173
186
|
|
|
174
187
|
**Everything is automatic!** 🎉
|
|
175
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SIMPLE_PROTOCOL_GUIDE.md
RENAMED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## The Problem
|
|
4
4
|
|
|
5
5
|
Implementing protocol support manually is complicated:
|
|
6
|
+
|
|
6
7
|
- Need to parse SQL WHERE clauses
|
|
7
8
|
- Need to use evaluator
|
|
8
9
|
- Need to handle column pruning
|
|
@@ -17,6 +18,7 @@ We've created helper functions that **automate everything**!
|
|
|
17
18
|
## Method 1: Register File Sources (Easiest!)
|
|
18
19
|
|
|
19
20
|
**Before (complicated):**
|
|
21
|
+
|
|
20
22
|
```python
|
|
21
23
|
def jsonl_source(filepath, dynamic_where=None, dynamic_columns=None):
|
|
22
24
|
# Parse WHERE clause
|
|
@@ -26,6 +28,7 @@ def jsonl_source(filepath, dynamic_where=None, dynamic_columns=None):
|
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
**After (simple):**
|
|
31
|
+
|
|
29
32
|
```python
|
|
30
33
|
from streaming_sql_engine.protocol_helpers import register_file_source
|
|
31
34
|
|
|
@@ -40,6 +43,7 @@ register_file_source(engine, "categories", "data/categories.csv")
|
|
|
40
43
|
## Method 2: Use Decorator (For Custom Sources)
|
|
41
44
|
|
|
42
45
|
**Before:**
|
|
46
|
+
|
|
43
47
|
```python
|
|
44
48
|
def my_source(filepath):
|
|
45
49
|
# Your code
|
|
@@ -50,6 +54,7 @@ def my_source(filepath):
|
|
|
50
54
|
```
|
|
51
55
|
|
|
52
56
|
**After:**
|
|
57
|
+
|
|
53
58
|
```python
|
|
54
59
|
from streaming_sql_engine.protocol_helpers import add_protocol_support
|
|
55
60
|
|
|
@@ -67,6 +72,7 @@ def my_source(filepath):
|
|
|
67
72
|
## Method 3: Wrap Existing Function
|
|
68
73
|
|
|
69
74
|
**Before:**
|
|
75
|
+
|
|
70
76
|
```python
|
|
71
77
|
def existing_source(filepath):
|
|
72
78
|
# Your existing code (no protocol)
|
|
@@ -76,6 +82,7 @@ def existing_source(filepath):
|
|
|
76
82
|
```
|
|
77
83
|
|
|
78
84
|
**After:**
|
|
85
|
+
|
|
79
86
|
```python
|
|
80
87
|
from streaming_sql_engine.protocol_helpers import wrap_simple_source
|
|
81
88
|
|
|
@@ -90,6 +97,7 @@ protocol_source = wrap_simple_source(existing_source)
|
|
|
90
97
|
## Method 4: Register API Sources
|
|
91
98
|
|
|
92
99
|
**Before:**
|
|
100
|
+
|
|
93
101
|
```python
|
|
94
102
|
def api_source(dynamic_where=None, dynamic_columns=None):
|
|
95
103
|
# Parse WHERE clause
|
|
@@ -99,6 +107,7 @@ def api_source(dynamic_where=None, dynamic_columns=None):
|
|
|
99
107
|
```
|
|
100
108
|
|
|
101
109
|
**After:**
|
|
110
|
+
|
|
102
111
|
```python
|
|
103
112
|
from streaming_sql_engine.protocol_helpers import register_api_source
|
|
104
113
|
|
|
@@ -150,9 +159,11 @@ for row in engine.query("""
|
|
|
150
159
|
## Available Helpers
|
|
151
160
|
|
|
152
161
|
### `register_file_source(engine, table_name, filepath, filename=None, ordered_by=None)`
|
|
162
|
+
|
|
153
163
|
Register a file source with automatic protocol support.
|
|
154
164
|
|
|
155
165
|
**Parameters:**
|
|
166
|
+
|
|
156
167
|
- `engine`: Engine instance
|
|
157
168
|
- `table_name`: Table name for SQL queries
|
|
158
169
|
- `filepath`: Path to file (JSONL or CSV)
|
|
@@ -160,6 +171,7 @@ Register a file source with automatic protocol support.
|
|
|
160
171
|
- `ordered_by`: Optional column name for merge joins
|
|
161
172
|
|
|
162
173
|
**Example:**
|
|
174
|
+
|
|
163
175
|
```python
|
|
164
176
|
register_file_source(engine, "products", "data/products.jsonl")
|
|
165
177
|
```
|
|
@@ -167,9 +179,11 @@ register_file_source(engine, "products", "data/products.jsonl")
|
|
|
167
179
|
---
|
|
168
180
|
|
|
169
181
|
### `register_api_source(engine, table_name, api_url, endpoint, where_to_params=None)`
|
|
182
|
+
|
|
170
183
|
Register an API source with automatic protocol support.
|
|
171
184
|
|
|
172
185
|
**Parameters:**
|
|
186
|
+
|
|
173
187
|
- `engine`: Engine instance
|
|
174
188
|
- `table_name`: Table name for SQL queries
|
|
175
189
|
- `api_url`: Base URL of API
|
|
@@ -177,6 +191,7 @@ Register an API source with automatic protocol support.
|
|
|
177
191
|
- `where_to_params`: Optional function to convert WHERE clause to query params
|
|
178
192
|
|
|
179
193
|
**Example:**
|
|
194
|
+
|
|
180
195
|
```python
|
|
181
196
|
register_api_source(engine, "customers", "http://localhost:8000", "customers")
|
|
182
197
|
```
|
|
@@ -184,9 +199,11 @@ register_api_source(engine, "customers", "http://localhost:8000", "customers")
|
|
|
184
199
|
---
|
|
185
200
|
|
|
186
201
|
### `@add_protocol_support`
|
|
202
|
+
|
|
187
203
|
Decorator that adds protocol support to any source function.
|
|
188
204
|
|
|
189
205
|
**Example:**
|
|
206
|
+
|
|
190
207
|
```python
|
|
191
208
|
@add_protocol_support
|
|
192
209
|
def my_source(filepath: str):
|
|
@@ -198,9 +215,11 @@ def my_source(filepath: str):
|
|
|
198
215
|
---
|
|
199
216
|
|
|
200
217
|
### `wrap_simple_source(source_fn)`
|
|
218
|
+
|
|
201
219
|
Wrap an existing source function to add protocol support.
|
|
202
220
|
|
|
203
221
|
**Example:**
|
|
222
|
+
|
|
204
223
|
```python
|
|
205
224
|
def existing_source(filepath: str):
|
|
206
225
|
# Your existing code
|
|
@@ -212,9 +231,11 @@ protocol_source = wrap_simple_source(existing_source)
|
|
|
212
231
|
---
|
|
213
232
|
|
|
214
233
|
### `create_protocol_source(filepath, file_type='auto')`
|
|
234
|
+
|
|
215
235
|
Create a protocol-enabled source function from a file path.
|
|
216
236
|
|
|
217
237
|
**Example:**
|
|
238
|
+
|
|
218
239
|
```python
|
|
219
240
|
source = create_protocol_source("data/products.jsonl")
|
|
220
241
|
engine.register("products", source)
|
|
@@ -228,7 +249,7 @@ engine.register("products", source)
|
|
|
228
249
|
✅ **No manual filter evaluation** - Uses engine's evaluator
|
|
229
250
|
✅ **No manual column pruning** - Handled automatically
|
|
230
251
|
✅ **Works with any source type** - Files, APIs, databases
|
|
231
|
-
✅ **Same performance** - Uses same optimizations as manual implementation
|
|
252
|
+
✅ **Same performance** - Uses same optimizations as manual implementation
|
|
232
253
|
|
|
233
254
|
---
|
|
234
255
|
|
|
@@ -245,7 +266,6 @@ engine.register("products", source)
|
|
|
245
266
|
## Summary
|
|
246
267
|
|
|
247
268
|
**Before:** 50-100 lines of manual protocol implementation
|
|
248
|
-
**After:** 1 line with helper functions
|
|
269
|
+
**After:** 1 line with helper functions
|
|
249
270
|
|
|
250
271
|
**Protocol support is now automatic!** 🎉
|
|
251
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SIMPLE_SOURCE_FUNCTIONS.md
RENAMED
|
@@ -25,6 +25,7 @@ engine.register("products", lambda: csv_source("data.csv"))
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
**That's it!** Just 5 lines. The engine:
|
|
28
|
+
|
|
28
29
|
- ✅ Filters rows (using evaluator)
|
|
29
30
|
- ✅ Selects columns (column pruning)
|
|
30
31
|
- ✅ Applies WHERE clauses
|
|
@@ -43,28 +44,29 @@ def csv_source(
|
|
|
43
44
|
"""Complex source - manual parsing."""
|
|
44
45
|
with open(filepath, 'r') as f:
|
|
45
46
|
reader = csv.DictReader(f)
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
# Manual column pruning
|
|
48
49
|
if dynamic_columns:
|
|
49
50
|
columns_to_keep = [col for col in reader.fieldnames if col in dynamic_columns]
|
|
50
51
|
else:
|
|
51
52
|
columns_to_keep = reader.fieldnames
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
for row in reader:
|
|
54
55
|
# Manual filter parsing
|
|
55
56
|
if dynamic_where:
|
|
56
57
|
if "name = 'Electronics'" in dynamic_where:
|
|
57
58
|
if row.get('name') != 'Electronics':
|
|
58
59
|
continue
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
# Manual column selection
|
|
61
62
|
if dynamic_columns:
|
|
62
63
|
row = {k: v for k, v in row.items() if k in columns_to_keep}
|
|
63
|
-
|
|
64
|
+
|
|
64
65
|
yield row
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
**Why this is bad:**
|
|
69
|
+
|
|
68
70
|
- ❌ 30+ lines instead of 5
|
|
69
71
|
- ❌ Manual SQL parsing (error-prone)
|
|
70
72
|
- ❌ Duplicates engine logic
|
|
@@ -123,13 +125,14 @@ def file_source(filepath: str) -> Iterator[Dict]:
|
|
|
123
125
|
## Summary
|
|
124
126
|
|
|
125
127
|
**For file sources:**
|
|
128
|
+
|
|
126
129
|
- ✅ **Simple:** Just read and yield
|
|
127
130
|
- ✅ **Engine handles:** Filtering, column pruning, WHERE clauses
|
|
128
131
|
- ✅ **Less code:** 5 lines instead of 30+
|
|
129
132
|
|
|
130
133
|
**For database/API sources:**
|
|
134
|
+
|
|
131
135
|
- ✅ **Use protocol:** Can optimize better than engine
|
|
132
136
|
- ✅ **Pass SQL/parameters:** Let source handle filtering/selection
|
|
133
137
|
|
|
134
138
|
**Key insight:** The engine's evaluator is already optimized. Don't duplicate its logic in file sources!
|
|
135
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHAT_IS_WHERE_TO_PARAMS.md
RENAMED
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
### The Problem
|
|
8
8
|
|
|
9
9
|
When you write:
|
|
10
|
+
|
|
10
11
|
```sql
|
|
11
12
|
WHERE customers.active = true AND customers.country = 'US'
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
The engine passes this as a **SQL string** to your source function:
|
|
16
|
+
|
|
15
17
|
```python
|
|
16
18
|
dynamic_where = "customers.active = true AND customers.country = 'US'"
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
But your API expects **query parameters**:
|
|
22
|
+
|
|
20
23
|
```
|
|
21
24
|
GET /customers?active=true&country=US
|
|
22
25
|
```
|
|
@@ -40,13 +43,13 @@ dynamic_where = "customers.active = true AND customers.country = 'US'"
|
|
|
40
43
|
def where_to_params(where_clause: str) -> dict:
|
|
41
44
|
# Convert SQL WHERE clause to API query parameters
|
|
42
45
|
params = {}
|
|
43
|
-
|
|
46
|
+
|
|
44
47
|
if "active = true" in where_clause:
|
|
45
48
|
params['active'] = 'true'
|
|
46
|
-
|
|
49
|
+
|
|
47
50
|
if "country = 'US'" in where_clause:
|
|
48
51
|
params['country'] = 'US'
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
return params
|
|
51
54
|
|
|
52
55
|
# Result:
|
|
@@ -76,6 +79,7 @@ def get_customers(
|
|
|
76
79
|
```
|
|
77
80
|
|
|
78
81
|
**The API expects:**
|
|
82
|
+
|
|
79
83
|
- `?active=true` (not `?active=true` from SQL `active = true`)
|
|
80
84
|
- `?country=US` (not `?country='US'` from SQL `country = 'US'`)
|
|
81
85
|
|
|
@@ -114,6 +118,7 @@ register_api_source(
|
|
|
114
118
|
```
|
|
115
119
|
|
|
116
120
|
**The default converter should work!** It automatically:
|
|
121
|
+
|
|
117
122
|
- Parses `customers.active = true` → `params['active'] = 'true'`
|
|
118
123
|
- Parses `customers.country = 'US'` → `params['country'] = 'US'`
|
|
119
124
|
|
|
@@ -124,6 +129,7 @@ register_api_source(
|
|
|
124
129
|
Only if your API uses a **special format**:
|
|
125
130
|
|
|
126
131
|
### Example 1: Nested Parameters
|
|
132
|
+
|
|
127
133
|
```python
|
|
128
134
|
# API expects: ?filter[active]=true
|
|
129
135
|
# Default: ?active=true (doesn't match!)
|
|
@@ -136,6 +142,7 @@ def custom_converter(where_clause: str) -> dict:
|
|
|
136
142
|
```
|
|
137
143
|
|
|
138
144
|
### Example 2: Different Parameter Names
|
|
145
|
+
|
|
139
146
|
```python
|
|
140
147
|
# API expects: ?is_active=true
|
|
141
148
|
# Default: ?active=true (wrong name!)
|
|
@@ -171,6 +178,7 @@ GET /customers?active=true&country=US
|
|
|
171
178
|
**You probably DON'T need it!** The default converter should work.
|
|
172
179
|
|
|
173
180
|
**Try removing it:**
|
|
181
|
+
|
|
174
182
|
```python
|
|
175
183
|
# Before (with custom converter):
|
|
176
184
|
register_api_source(engine, "customers", API_BASE_URL, "customers",
|
|
@@ -190,4 +198,3 @@ register_api_source(engine, "customers", API_BASE_URL, "customers")
|
|
|
190
198
|
2. **Default converter** handles most cases automatically
|
|
191
199
|
3. **Custom converter** only needed for special API formats
|
|
192
200
|
4. **Your example** probably doesn't need it - try removing it!
|
|
193
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_API_CONVERTER_NEEDED.md
RENAMED
|
@@ -32,11 +32,13 @@ register_api_source(engine, "customers", "http://localhost:8000", "customers")
|
|
|
32
32
|
- Multiple conditions (AND) → Multiple params
|
|
33
33
|
|
|
34
34
|
**Example:**
|
|
35
|
+
|
|
35
36
|
```sql
|
|
36
37
|
WHERE customers.active = true AND customers.price > 100
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
**Automatically converts to:**
|
|
41
|
+
|
|
40
42
|
```python
|
|
41
43
|
params = {
|
|
42
44
|
'active': 'true',
|
|
@@ -146,18 +148,21 @@ register_api_source(engine, "customers", "http://api.com", "customers")
|
|
|
146
148
|
The default converter automatically handles:
|
|
147
149
|
|
|
148
150
|
### ✅ Equality Conditions
|
|
151
|
+
|
|
149
152
|
```sql
|
|
150
153
|
WHERE column = value
|
|
151
154
|
→ params[column] = value
|
|
152
155
|
```
|
|
153
156
|
|
|
154
157
|
### ✅ Boolean Conditions
|
|
158
|
+
|
|
155
159
|
```sql
|
|
156
160
|
WHERE active = true
|
|
157
161
|
→ params[active] = 'true'
|
|
158
162
|
```
|
|
159
163
|
|
|
160
164
|
### ✅ Comparison Conditions
|
|
165
|
+
|
|
161
166
|
```sql
|
|
162
167
|
WHERE price > 100
|
|
163
168
|
→ params[min_price] = '100'
|
|
@@ -167,12 +172,14 @@ WHERE price < 200
|
|
|
167
172
|
```
|
|
168
173
|
|
|
169
174
|
### ✅ Multiple Conditions (AND)
|
|
175
|
+
|
|
170
176
|
```sql
|
|
171
177
|
WHERE active = true AND price > 100
|
|
172
178
|
→ params[active] = 'true', params[min_price] = '100'
|
|
173
179
|
```
|
|
174
180
|
|
|
175
181
|
### ❌ Complex Conditions
|
|
182
|
+
|
|
176
183
|
```sql
|
|
177
184
|
WHERE (active = true OR status = 'pending') AND price > 100
|
|
178
185
|
→ Not fully supported (needs custom converter)
|
|
@@ -189,6 +196,7 @@ WHERE (active = true OR status = 'pending') AND price > 100
|
|
|
189
196
|
✅ **Standard parameter names** (column names match)
|
|
190
197
|
|
|
191
198
|
**Just use:**
|
|
199
|
+
|
|
192
200
|
```python
|
|
193
201
|
register_api_source(engine, "customers", "http://api.com", "customers")
|
|
194
202
|
```
|
|
@@ -200,6 +208,7 @@ register_api_source(engine, "customers", "http://api.com", "customers")
|
|
|
200
208
|
❌ **Non-standard APIs** (GraphQL, custom formats)
|
|
201
209
|
|
|
202
210
|
**Provide custom converter:**
|
|
211
|
+
|
|
203
212
|
```python
|
|
204
213
|
def my_converter(where_clause: str) -> dict:
|
|
205
214
|
# Custom conversion logic
|
|
@@ -217,4 +226,3 @@ register_api_source(engine, "customers", "http://api.com", "customers",
|
|
|
217
226
|
**API sources:** Different formats (query params) → Mostly automatic, converter only if special format ⚠️
|
|
218
227
|
|
|
219
228
|
**The default converter handles 90% of cases!** You only need custom converter for special APIs.
|
|
220
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_MANUAL_PARSING.md
RENAMED
|
@@ -106,7 +106,7 @@ if evaluate_expression(pushable_where_expr, row):
|
|
|
106
106
|
def file_source(dynamic_where=None, dynamic_columns=None):
|
|
107
107
|
# If engine passed AST, use evaluator
|
|
108
108
|
from streaming_sql_engine.evaluator import evaluate_expression
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
for row in read_file():
|
|
111
111
|
if dynamic_where_expr: # AST, not string
|
|
112
112
|
if not evaluate_expression(dynamic_where_expr, row):
|
|
@@ -151,6 +151,7 @@ def file_source(dynamic_where=None, dynamic_columns=None):
|
|
|
151
151
|
**For files:** Manual parsing is inefficient - better to use evaluator with AST ⚠️
|
|
152
152
|
|
|
153
153
|
**The manual `if` statements are a workaround** because:
|
|
154
|
+
|
|
154
155
|
1. Engine passes SQL string (designed for databases)
|
|
155
156
|
2. Files can't execute SQL directly
|
|
156
157
|
3. Need to parse string to evaluate in Python
|
|
@@ -163,17 +164,19 @@ def file_source(dynamic_where=None, dynamic_columns=None):
|
|
|
163
164
|
## Summary
|
|
164
165
|
|
|
165
166
|
**Why manual parsing exists:**
|
|
167
|
+
|
|
166
168
|
- Engine passes SQL string (for database compatibility)
|
|
167
169
|
- File sources need to evaluate in Python
|
|
168
170
|
- Manual parsing is a workaround
|
|
169
171
|
|
|
170
172
|
**Better approach:**
|
|
173
|
+
|
|
171
174
|
- Engine could pass expression AST
|
|
172
175
|
- Sources use evaluator (no parsing needed)
|
|
173
176
|
- But requires protocol change
|
|
174
177
|
|
|
175
178
|
**For now:**
|
|
179
|
+
|
|
176
180
|
- Database sources: Use SQL string directly ✅
|
|
177
181
|
- File sources: Manual parsing (workaround) ⚠️
|
|
178
182
|
- Or: Don't support filter pushdown for files (let engine filter)
|
|
179
|
-
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/WHY_PROTOCOL_IN_SOURCES.md
RENAMED
|
@@ -45,11 +45,11 @@ def optimized_source(dynamic_where=None, dynamic_columns=None):
|
|
|
45
45
|
# Build query with optimizations
|
|
46
46
|
columns = dynamic_columns or ["*"]
|
|
47
47
|
where = dynamic_where or ""
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
query = f"SELECT {', '.join(columns)} FROM users"
|
|
50
50
|
if where:
|
|
51
51
|
query += f" WHERE {where}"
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
# Source filters/selects BEFORE returning data
|
|
54
54
|
return execute(query) # Gets only 500 rows, only 'name' column
|
|
55
55
|
|
|
@@ -76,27 +76,32 @@ query = "SELECT users.name FROM users WHERE users.id > 100"
|
|
|
76
76
|
### The Problem: Different Sources Have Different Capabilities
|
|
77
77
|
|
|
78
78
|
**Database source:**
|
|
79
|
+
|
|
79
80
|
- Can filter efficiently (uses indexes)
|
|
80
81
|
- Can select specific columns (SQL)
|
|
81
82
|
- Should filter/select at database level
|
|
82
83
|
|
|
83
84
|
**API source:**
|
|
85
|
+
|
|
84
86
|
- Can filter via query parameters (`?active=true`)
|
|
85
87
|
- Can select fields via parameters (`?fields=name,email`)
|
|
86
88
|
- Should filter/select at API level
|
|
87
89
|
|
|
88
90
|
**File source:**
|
|
91
|
+
|
|
89
92
|
- Can filter while reading (skip rows)
|
|
90
93
|
- Can select columns while reading (skip columns)
|
|
91
94
|
- Should filter/select while reading
|
|
92
95
|
|
|
93
96
|
**Simple iterator:**
|
|
97
|
+
|
|
94
98
|
- Can't filter/select efficiently
|
|
95
99
|
- Engine must handle it
|
|
96
100
|
|
|
97
101
|
### The Solution: Protocol-Based Detection
|
|
98
102
|
|
|
99
103
|
**Engine automatically detects:**
|
|
104
|
+
|
|
100
105
|
- Does source accept `dynamic_where`? → Can push filters
|
|
101
106
|
- Does source accept `dynamic_columns`? → Can prune columns
|
|
102
107
|
|
|
@@ -116,6 +121,7 @@ plan.pushable_where_expr = analyze_filter_pushdown(plan)
|
|
|
116
121
|
```
|
|
117
122
|
|
|
118
123
|
**Engine determines:**
|
|
124
|
+
|
|
119
125
|
- Which columns are needed: `['id', 'name']`
|
|
120
126
|
- Which WHERE clauses can be pushed: `"users.id > 100"`
|
|
121
127
|
|
|
@@ -163,22 +169,26 @@ def optimized_source(dynamic_where=None, dynamic_columns=None):
|
|
|
163
169
|
### Option A: Engine Handles Everything (Current for Simple Sources)
|
|
164
170
|
|
|
165
171
|
**Pros:**
|
|
172
|
+
|
|
166
173
|
- ✅ Simple sources work without modification
|
|
167
174
|
- ✅ No protocol needed
|
|
168
175
|
|
|
169
176
|
**Cons:**
|
|
177
|
+
|
|
170
178
|
- ❌ Inefficient (processes all data in Python)
|
|
171
179
|
- ❌ Can't use source-level optimizations (database indexes, API filters)
|
|
172
180
|
|
|
173
181
|
### Option B: Protocol-Based (Current for Optimized Sources)
|
|
174
182
|
|
|
175
183
|
**Pros:**
|
|
184
|
+
|
|
176
185
|
- ✅ Efficient (source filters/selects before sending)
|
|
177
186
|
- ✅ Uses source-level optimizations (database indexes, API filters)
|
|
178
187
|
- ✅ Less data transfer
|
|
179
188
|
- ✅ Less memory usage
|
|
180
189
|
|
|
181
190
|
**Cons:**
|
|
191
|
+
|
|
182
192
|
- ⚠️ Source needs to accept parameters (but simple - just add them!)
|
|
183
193
|
|
|
184
194
|
---
|
|
@@ -238,14 +248,15 @@ for row in engine.query("SELECT users.name FROM users WHERE users.id > 100"):
|
|
|
238
248
|
4. **Source uses parameters** → Filters/selects efficiently
|
|
239
249
|
|
|
240
250
|
**Without protocol:**
|
|
251
|
+
|
|
241
252
|
- ✅ Engine still works
|
|
242
253
|
- ✅ Engine handles filtering/selection internally
|
|
243
254
|
- ⚠️ Less efficient (processes all data in Python)
|
|
244
255
|
|
|
245
256
|
**With protocol:**
|
|
257
|
+
|
|
246
258
|
- ✅ Engine works
|
|
247
259
|
- ✅ Source handles filtering/selection efficiently
|
|
248
260
|
- ✅ Much faster (source optimizes before sending data)
|
|
249
261
|
|
|
250
262
|
**The protocol is optional but enables huge performance improvements!**
|
|
251
|
-
|
|
@@ -125,9 +125,10 @@ def execute_plan(
|
|
|
125
125
|
print(f" [DEBUG] Initial remaining_where_expr: {remaining_where_expr}")
|
|
126
126
|
|
|
127
127
|
for i, join_info in enumerate(plan.joins, 1):
|
|
128
|
+
# Get required columns for joined table (needed for optimizations)
|
|
129
|
+
join_required_columns = plan.required_columns.get(join_info.table)
|
|
130
|
+
|
|
128
131
|
if debug:
|
|
129
|
-
# Get required columns for joined table
|
|
130
|
-
join_required_columns = plan.required_columns.get(join_info.table)
|
|
131
132
|
if join_required_columns:
|
|
132
133
|
print(f" [JOIN {i}/{len(plan.joins)}] {join_info.join_type} JOIN {join_info.table} (columns: {len(join_required_columns)})")
|
|
133
134
|
else:
|
|
@@ -4,11 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "streaming-sql-engine"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.6"
|
|
8
8
|
description = "A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
|
-
license = {text = "MIT"}
|
|
12
11
|
authors = [
|
|
13
12
|
{name = "Theodore Pantazopoulo", email = "your.email@example.com"}
|
|
14
13
|
]
|
|
@@ -60,3 +59,10 @@ Repository = "https://github.com/Ierofantis/streaming-sql-engine/tree/master"
|
|
|
60
59
|
Issues = "https://github.com/Ierofantis/streaming-sql-engine/issues"
|
|
61
60
|
Documentation = "https://github.com/Ierofantis/streaming-sql-engine/tree/master#readme"
|
|
62
61
|
|
|
62
|
+
[tool.setuptools]
|
|
63
|
+
packages = ["streaming_sql_engine"]
|
|
64
|
+
package-dir = {"streaming_sql_engine" = "."}
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
"*" = ["*.md", "*.txt"]
|
|
68
|
+
|
|
@@ -12,7 +12,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh:
|
|
|
12
12
|
|
|
13
13
|
setup(
|
|
14
14
|
name="streaming-sql-engine",
|
|
15
|
-
version="0.1.
|
|
15
|
+
version="0.1.6",
|
|
16
16
|
author="Theodore Pantazopoulo",
|
|
17
17
|
author_email="your.email@example.com",
|
|
18
18
|
description="A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources",
|
|
@@ -42,7 +42,6 @@ setup(
|
|
|
42
42
|
"Intended Audience :: Developers",
|
|
43
43
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
44
44
|
"Topic :: Database",
|
|
45
|
-
"License :: OSI Approved :: MIT License",
|
|
46
45
|
"Programming Language :: Python :: 3",
|
|
47
46
|
"Programming Language :: Python :: 3.8",
|
|
48
47
|
"Programming Language :: Python :: 3.9",
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6/streaming_sql_engine.egg-info}/PKG-INFO
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streaming-sql-engine
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: A lightweight SQL execution engine for streaming row-by-row queries with joins across multiple data sources
|
|
5
5
|
Home-page: https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
6
6
|
Author: Theodore Pantazopoulo
|
|
7
7
|
Author-email: Theodore Pantazopoulo <your.email@example.com>
|
|
8
|
-
License: MIT
|
|
9
8
|
Project-URL: Homepage, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
10
9
|
Project-URL: Repository, https://github.com/Ierofantis/streaming-sql-engine/tree/master
|
|
11
10
|
Project-URL: Issues, https://github.com/Ierofantis/streaming-sql-engine/issues
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/SOURCES.txt
RENAMED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
DEPLOYMENT.md
|
|
1
2
|
MANIFEST.in
|
|
3
|
+
QUICK_DEPLOY.md
|
|
4
|
+
QUICK_FIX.md
|
|
2
5
|
README.md
|
|
3
6
|
__init__.py
|
|
4
7
|
engine.py
|
|
@@ -17,6 +20,10 @@ protocol_helpers.py
|
|
|
17
20
|
pyproject.toml
|
|
18
21
|
requirements.txt
|
|
19
22
|
setup.py
|
|
23
|
+
./DEPLOYMENT.md
|
|
24
|
+
./QUICK_DEPLOY.md
|
|
25
|
+
./QUICK_FIX.md
|
|
26
|
+
./README.md
|
|
20
27
|
./__init__.py
|
|
21
28
|
./engine.py
|
|
22
29
|
./evaluator.py
|
|
@@ -31,6 +38,7 @@ setup.py
|
|
|
31
38
|
./polars_expression_translator.py
|
|
32
39
|
./polars_operators.py
|
|
33
40
|
./protocol_helpers.py
|
|
41
|
+
./requirements.txt
|
|
34
42
|
./setup.py
|
|
35
43
|
documentation/APACHE_DRILL_COMPARISON.md
|
|
36
44
|
documentation/API_JOIN_OPERATIONS.md
|
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/APACHE_DRILL_COMPARISON.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/API_JOIN_OPERATIONS.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/ARCHITECTURE_DECISION.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/ARCHITECTURE_SYNCED.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/BETTER_FILTER_APPROACH.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/DUCKDB_COMPARISON.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/FINAL_RECOMMENDATION.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/HOW_TO_ADD_TO_PROJECT.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/JSONL_EXECUTOR_ANALYSIS.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/JSONL_EXECUTOR_REMOVED.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/LIBRARY_DOCUMENTATION.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZATIONS_BREAKDOWN.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/OPTIMIZATIONS_VS_POLARS.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PERFORMANCE_COMPARISON.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/POLARS_AND_MMAP_GUIDE.md
RENAMED
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/PROTOCOL_EXPLANATION.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/SOURCE_COMBINATIONS_GUIDE.md
RENAMED
|
File without changes
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/documentation/TECHNICAL_DOCUMENTATION.md
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
|
{streaming_sql_engine-0.1.4 → streaming_sql_engine-0.1.6}/streaming_sql_engine.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|