sqlo 0.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.
- sqlo-0.0.1/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
- sqlo-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- sqlo-0.0.1/.github/pull_request_template.md +22 -0
- sqlo-0.0.1/.github/workflows/ci.yml +56 -0
- sqlo-0.0.1/.github/workflows/publish.yml +30 -0
- sqlo-0.0.1/.gitignore +52 -0
- sqlo-0.0.1/.pre-commit-config.yaml +18 -0
- sqlo-0.0.1/CHANGELOG.md +16 -0
- sqlo-0.0.1/CONTRIBUTING.md +17 -0
- sqlo-0.0.1/DEVELOPMENT.md +76 -0
- sqlo-0.0.1/LICENSE +21 -0
- sqlo-0.0.1/Makefile +64 -0
- sqlo-0.0.1/PKG-INFO +88 -0
- sqlo-0.0.1/README.md +57 -0
- sqlo-0.0.1/docs/README.md +63 -0
- sqlo-0.0.1/docs/conditions.md +167 -0
- sqlo-0.0.1/docs/delete.md +202 -0
- sqlo-0.0.1/docs/expressions.md +109 -0
- sqlo-0.0.1/docs/getting-started.md +138 -0
- sqlo-0.0.1/docs/index.rst +41 -0
- sqlo-0.0.1/docs/insert.md +424 -0
- sqlo-0.0.1/docs/joins.md +211 -0
- sqlo-0.0.1/docs/security.md +190 -0
- sqlo-0.0.1/docs/select.md +518 -0
- sqlo-0.0.1/docs/update.md +551 -0
- sqlo-0.0.1/pyproject.toml +92 -0
- sqlo-0.0.1/src/sqlo/__init__.py +4 -0
- sqlo-0.0.1/src/sqlo/builder.py +44 -0
- sqlo-0.0.1/src/sqlo/constants.py +4 -0
- sqlo-0.0.1/src/sqlo/dialects/base.py +29 -0
- sqlo-0.0.1/src/sqlo/dialects/mysql.py +12 -0
- sqlo-0.0.1/src/sqlo/expressions.py +504 -0
- sqlo-0.0.1/src/sqlo/py.typed +0 -0
- sqlo-0.0.1/src/sqlo/query/base.py +22 -0
- sqlo-0.0.1/src/sqlo/query/delete.py +89 -0
- sqlo-0.0.1/src/sqlo/query/insert.py +128 -0
- sqlo-0.0.1/src/sqlo/query/mixins.py +279 -0
- sqlo-0.0.1/src/sqlo/query/select.py +412 -0
- sqlo-0.0.1/src/sqlo/query/update.py +129 -0
- sqlo-0.0.1/src/sqlo/security.py +132 -0
- sqlo-0.0.1/tests/__init__.py +0 -0
- sqlo-0.0.1/tests/benchmark.py +143 -0
- sqlo-0.0.1/tests/unit/test_advanced_conditions.py +376 -0
- sqlo-0.0.1/tests/unit/test_builder.py +58 -0
- sqlo-0.0.1/tests/unit/test_condition_parsing.py +53 -0
- sqlo-0.0.1/tests/unit/test_conditions.py +99 -0
- sqlo-0.0.1/tests/unit/test_delete_query.py +97 -0
- sqlo-0.0.1/tests/unit/test_dialects.py +35 -0
- sqlo-0.0.1/tests/unit/test_expressions.py +57 -0
- sqlo-0.0.1/tests/unit/test_extended_operators.py +29 -0
- sqlo-0.0.1/tests/unit/test_insert_query.py +109 -0
- sqlo-0.0.1/tests/unit/test_joins.py +72 -0
- sqlo-0.0.1/tests/unit/test_like_operator.py +8 -0
- sqlo-0.0.1/tests/unit/test_optimizer_hints.py +22 -0
- sqlo-0.0.1/tests/unit/test_security.py +120 -0
- sqlo-0.0.1/tests/unit/test_select_query.py +303 -0
- sqlo-0.0.1/tests/unit/test_update_query.py +115 -0
- sqlo-0.0.1/tests/unit/test_where_having.py +69 -0
- sqlo-0.0.1/tests/unit/test_where_having_extensions.py +62 -0
- sqlo-0.0.1/uv.lock +1082 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
Please provide a code snippet that reproduces the issue:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from sqlo import Q
|
|
17
|
+
|
|
18
|
+
# Your code here
|
|
19
|
+
query = Q.select("...")...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Expected behavior**
|
|
23
|
+
A clear and concise description of what you expected to happen.
|
|
24
|
+
|
|
25
|
+
**Screenshots**
|
|
26
|
+
If applicable, add screenshots to help explain your problem.
|
|
27
|
+
|
|
28
|
+
**Environment (please complete the following information):**
|
|
29
|
+
- OS: [e.g. macOS, Windows, Linux]
|
|
30
|
+
- Python Version [e.g. 3.11]
|
|
31
|
+
- sqlo Version [e.g. 0.0.1]
|
|
32
|
+
|
|
33
|
+
**Additional context**
|
|
34
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex: I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
|
|
4
|
+
|
|
5
|
+
Fixes # (issue)
|
|
6
|
+
|
|
7
|
+
## Type of change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
10
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
11
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
12
|
+
- [ ] Documentation update
|
|
13
|
+
|
|
14
|
+
## Checklist:
|
|
15
|
+
|
|
16
|
+
- [ ] My code follows the style guidelines of this project
|
|
17
|
+
- [ ] I have performed a self-review of my own code
|
|
18
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
19
|
+
- [ ] I have made corresponding changes to the documentation
|
|
20
|
+
- [ ] My changes generate no new warnings
|
|
21
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
|
22
|
+
- [ ] New and existing unit tests pass locally with my changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test Python ${{ matrix.python-version }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v4
|
|
23
|
+
with:
|
|
24
|
+
version: "latest"
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
27
|
+
run: uv python install ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --all-extras
|
|
31
|
+
|
|
32
|
+
- name: Run ruff format check
|
|
33
|
+
run: uv run ruff format --check .
|
|
34
|
+
|
|
35
|
+
- name: Run ruff linter
|
|
36
|
+
run: uv run ruff check .
|
|
37
|
+
|
|
38
|
+
- name: Run mypy
|
|
39
|
+
run: uv run mypy src/
|
|
40
|
+
|
|
41
|
+
- name: Run complexity check
|
|
42
|
+
run: uv run xenon --max-absolute C --max-modules C --max-average B src
|
|
43
|
+
|
|
44
|
+
- name: Run security check
|
|
45
|
+
run: uv run bandit -c pyproject.toml -r src
|
|
46
|
+
|
|
47
|
+
- name: Run tests
|
|
48
|
+
run: uv run pytest --cov=sqlo --cov-report=xml --cov-report=term
|
|
49
|
+
|
|
50
|
+
- name: Upload coverage
|
|
51
|
+
uses: codecov/codecov-action@v4
|
|
52
|
+
if: matrix.python-version == '3.11'
|
|
53
|
+
with:
|
|
54
|
+
file: ./coverage.xml
|
|
55
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
56
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.11"
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
run: pip install uv
|
|
23
|
+
|
|
24
|
+
- name: Build
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish
|
|
28
|
+
env:
|
|
29
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
30
|
+
run: uv publish
|
sqlo-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# Virtual Env
|
|
25
|
+
.env
|
|
26
|
+
.venv
|
|
27
|
+
env/
|
|
28
|
+
venv/
|
|
29
|
+
ENV/
|
|
30
|
+
env.bak/
|
|
31
|
+
venv.bak/
|
|
32
|
+
|
|
33
|
+
# Testing
|
|
34
|
+
.tox/
|
|
35
|
+
.coverage
|
|
36
|
+
.coverage.*
|
|
37
|
+
.cache
|
|
38
|
+
nosetests.xml
|
|
39
|
+
coverage.xml
|
|
40
|
+
*.cover
|
|
41
|
+
.hypothesis/
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
reports/
|
|
44
|
+
|
|
45
|
+
# IDEs
|
|
46
|
+
.idea/
|
|
47
|
+
.vscode/
|
|
48
|
+
*.swp
|
|
49
|
+
*.swo
|
|
50
|
+
|
|
51
|
+
# MacOS
|
|
52
|
+
.DS_Store
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.8.4
|
|
4
|
+
hooks:
|
|
5
|
+
# Run the formatter
|
|
6
|
+
- id: ruff-format
|
|
7
|
+
types_or: [python, pyi]
|
|
8
|
+
# Run the linter
|
|
9
|
+
- id: ruff
|
|
10
|
+
types_or: [python, pyi]
|
|
11
|
+
args: [--fix]
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
14
|
+
rev: v1.13.0
|
|
15
|
+
hooks:
|
|
16
|
+
- id: mypy
|
|
17
|
+
additional_dependencies: []
|
|
18
|
+
args: [--ignore-missing-imports]
|
sqlo-0.0.1/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.0.1] - 2025-11-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of `sqlo`.
|
|
12
|
+
- Support for SELECT, INSERT, UPDATE, DELETE queries.
|
|
13
|
+
- MySQL dialect support.
|
|
14
|
+
- Type-safe query building API.
|
|
15
|
+
- Comprehensive test coverage (99%).
|
|
16
|
+
- Code quality tools: ruff, mypy, xenon, bandit.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Contributing to sqlo
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to `sqlo`!
|
|
4
|
+
|
|
5
|
+
For detailed instructions on setting up your development environment, running tests, and code style guidelines, please refer to our [Development Guide](DEVELOPMENT.md).
|
|
6
|
+
|
|
7
|
+
## Pull Requests
|
|
8
|
+
|
|
9
|
+
1. Fork the repository.
|
|
10
|
+
2. Create a new branch for your feature or fix.
|
|
11
|
+
3. Make your changes and add tests.
|
|
12
|
+
4. Ensure all tests pass and code is formatted correctly (see [Development Guide](DEVELOPMENT.md)).
|
|
13
|
+
5. Submit a Pull Request.
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Development Workflow
|
|
2
|
+
|
|
3
|
+
## Using uv (Recommended)
|
|
4
|
+
|
|
5
|
+
uv doesn't require scripts configuration. Just use `uv run` directly:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run tests
|
|
9
|
+
uv run pytest
|
|
10
|
+
|
|
11
|
+
# Run tests with coverage
|
|
12
|
+
uv run pytest --cov=sqlo --cov-report=html
|
|
13
|
+
|
|
14
|
+
# Format code
|
|
15
|
+
uv run ruff format .
|
|
16
|
+
|
|
17
|
+
# Lint code
|
|
18
|
+
uv run ruff check .
|
|
19
|
+
|
|
20
|
+
# Auto-fix linting issues
|
|
21
|
+
uv run ruff check --fix .
|
|
22
|
+
|
|
23
|
+
# Type check
|
|
24
|
+
uv run mypy src/
|
|
25
|
+
|
|
26
|
+
# Install dependencies
|
|
27
|
+
uv sync --all-extras
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Using Makefile (Simpler)
|
|
31
|
+
|
|
32
|
+
We've created a Makefile for convenience:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Run tests
|
|
36
|
+
make test
|
|
37
|
+
|
|
38
|
+
# Run tests with coverage
|
|
39
|
+
make coverage
|
|
40
|
+
|
|
41
|
+
# Format code
|
|
42
|
+
make format
|
|
43
|
+
|
|
44
|
+
# Lint code
|
|
45
|
+
make lint
|
|
46
|
+
|
|
47
|
+
# Auto-fix linting issues
|
|
48
|
+
make lint-fix
|
|
49
|
+
|
|
50
|
+
# Type check
|
|
51
|
+
make typecheck
|
|
52
|
+
|
|
53
|
+
# Run all checks (format + lint + typecheck)
|
|
54
|
+
make check
|
|
55
|
+
|
|
56
|
+
# Install pre-commit hooks
|
|
57
|
+
make pre-commit-install
|
|
58
|
+
|
|
59
|
+
# Clean build artifacts
|
|
60
|
+
make clean
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Recommendation
|
|
64
|
+
|
|
65
|
+
- **For quick commands**: Use `uv run <command>`
|
|
66
|
+
- **For complex workflows**: Use `make <target>`
|
|
67
|
+
- **For CI/CD**: Use `uv run` directly
|
|
68
|
+
|
|
69
|
+
Example CI/CD workflow:
|
|
70
|
+
```yaml
|
|
71
|
+
- run: uv sync --all-extras
|
|
72
|
+
- run: uv run ruff format --check .
|
|
73
|
+
- run: uv run ruff check .
|
|
74
|
+
- run: uv run mypy src/
|
|
75
|
+
- run: uv run pytest --cov=sqlo
|
|
76
|
+
```
|
sqlo-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nan Guo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sqlo-0.0.1/Makefile
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.PHONY: install format lint check test coverage clean
|
|
2
|
+
|
|
3
|
+
# Install dependencies
|
|
4
|
+
install:
|
|
5
|
+
uv sync --all-extras
|
|
6
|
+
|
|
7
|
+
# Format code (imports and sources)
|
|
8
|
+
format:
|
|
9
|
+
uv run ruff check --select I --fix .
|
|
10
|
+
uv run ruff format .
|
|
11
|
+
|
|
12
|
+
# Check code style (format, lint, types)
|
|
13
|
+
style:
|
|
14
|
+
uv run ruff format --check .
|
|
15
|
+
uv run ruff check .
|
|
16
|
+
uv run mypy src/
|
|
17
|
+
|
|
18
|
+
# Check code complexity
|
|
19
|
+
complexity:
|
|
20
|
+
uv run xenon --max-absolute C --max-modules C --max-average B src
|
|
21
|
+
|
|
22
|
+
# Check security issues
|
|
23
|
+
security:
|
|
24
|
+
uv run bandit -c pyproject.toml -r src
|
|
25
|
+
|
|
26
|
+
# Run all checks (alias for style)
|
|
27
|
+
check: style
|
|
28
|
+
|
|
29
|
+
# Run tests
|
|
30
|
+
test:
|
|
31
|
+
uv run pytest --cov=sqlo --cov-report=term-missing
|
|
32
|
+
|
|
33
|
+
# Run tests with coverage
|
|
34
|
+
coverage:
|
|
35
|
+
uv run pytest --cov=sqlo --cov-report=html --cov-report=term-missing
|
|
36
|
+
|
|
37
|
+
# Test against multiple Python versions (requires pyenv or similar)
|
|
38
|
+
test-all-versions:
|
|
39
|
+
@echo "Testing Python 3.9..."
|
|
40
|
+
@uv run --python 3.9 pytest || echo "Python 3.9 not available"
|
|
41
|
+
@echo "Testing Python 3.10..."
|
|
42
|
+
@uv run --python 3.10 pytest || echo "Python 3.10 not available"
|
|
43
|
+
@echo "Testing Python 3.11..."
|
|
44
|
+
@uv run --python 3.11 pytest || echo "Python 3.11 not available"
|
|
45
|
+
@echo "Testing Python 3.12..."
|
|
46
|
+
@uv run --python 3.12 pytest || echo "Python 3.12 not available"
|
|
47
|
+
@echo "Testing Python 3.13..."
|
|
48
|
+
@uv run --python 3.13 pytest || echo "Python 3.13 not available"
|
|
49
|
+
@echo "Testing Python 3.14..."
|
|
50
|
+
@uv run --python 3.14 pytest || echo "Python 3.14 not available"
|
|
51
|
+
|
|
52
|
+
# Install pre-commit hooks
|
|
53
|
+
pre-commit-install:
|
|
54
|
+
uv run pre-commit install
|
|
55
|
+
|
|
56
|
+
# Run pre-commit on all files
|
|
57
|
+
pre-commit-run:
|
|
58
|
+
uv run pre-commit run --all-files
|
|
59
|
+
|
|
60
|
+
# Clean build artifacts
|
|
61
|
+
clean:
|
|
62
|
+
rm -rf build/ dist/ *.egg-info .pytest_cache .ruff_cache .mypy_cache htmlcov/
|
|
63
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
64
|
+
find . -type f -name '*.pyc' -delete
|
sqlo-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sqlo
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A modern, type-safe, and extensible SQL query builder for Python.
|
|
5
|
+
Project-URL: Homepage, https://github.com/nan-guo/sqlo
|
|
6
|
+
Project-URL: Repository, https://github.com/nan-guo/sqlo
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Database
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: bandit>=1.7.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-cov>=3.0.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=7.1.2; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: xenon>=0.9.0; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# sqlo
|
|
33
|
+
|
|
34
|
+
[](https://github.com/nan-guo/sqlo/actions/workflows/ci.yml)
|
|
35
|
+
[](https://pypi.org/project/sqlo/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
**sqlo** is a modern, type-safe, and extensible SQL query builder for Python. It allows you to construct complex SQL queries using a fluent, Pythonic API while ensuring safety against SQL injection.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- 🛡️ **Safe**: Automatic parameter binding prevents SQL injection.
|
|
44
|
+
- 🐍 **Pythonic**: Fluent API design that feels natural to Python developers.
|
|
45
|
+
- 🧩 **Composable**: Build complex queries from reusable parts.
|
|
46
|
+
- 🚀 **Extensible**: Support for custom dialects and functions.
|
|
47
|
+
- 🔍 **Type-Safe**: Designed with type hints for better IDE support.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install sqlo
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from sqlo import Q
|
|
59
|
+
|
|
60
|
+
# SELECT query
|
|
61
|
+
query = Q.select("id", "name").from_("users").where("active", True)
|
|
62
|
+
sql, params = query.build()
|
|
63
|
+
# SQL: SELECT `id`, `name` FROM `users` WHERE `active` = %s
|
|
64
|
+
# Params: (True,)
|
|
65
|
+
|
|
66
|
+
# INSERT query
|
|
67
|
+
query = Q.insert_into("users").values([
|
|
68
|
+
{"name": "Alice", "email": "alice@example.com"}
|
|
69
|
+
])
|
|
70
|
+
sql, params = query.build()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Documentation
|
|
74
|
+
|
|
75
|
+
Full documentation is available in the [docs](docs/) directory.
|
|
76
|
+
|
|
77
|
+
- [Getting Started](docs/getting-started.md)
|
|
78
|
+
- [SELECT Queries](docs/select.md)
|
|
79
|
+
- [INSERT Queries](docs/insert.md)
|
|
80
|
+
- [UPDATE Queries](docs/update.md)
|
|
81
|
+
- [DELETE Queries](docs/delete.md)
|
|
82
|
+
- [JOIN Operations](docs/joins.md)
|
|
83
|
+
- [Condition Objects](docs/conditions.md)
|
|
84
|
+
- [Expressions & Functions](docs/expressions.md)
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT License
|
sqlo-0.0.1/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# sqlo
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nan-guo/sqlo/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/sqlo/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**sqlo** is a modern, type-safe, and extensible SQL query builder for Python. It allows you to construct complex SQL queries using a fluent, Pythonic API while ensuring safety against SQL injection.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- 🛡️ **Safe**: Automatic parameter binding prevents SQL injection.
|
|
13
|
+
- 🐍 **Pythonic**: Fluent API design that feels natural to Python developers.
|
|
14
|
+
- 🧩 **Composable**: Build complex queries from reusable parts.
|
|
15
|
+
- 🚀 **Extensible**: Support for custom dialects and functions.
|
|
16
|
+
- 🔍 **Type-Safe**: Designed with type hints for better IDE support.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install sqlo
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from sqlo import Q
|
|
28
|
+
|
|
29
|
+
# SELECT query
|
|
30
|
+
query = Q.select("id", "name").from_("users").where("active", True)
|
|
31
|
+
sql, params = query.build()
|
|
32
|
+
# SQL: SELECT `id`, `name` FROM `users` WHERE `active` = %s
|
|
33
|
+
# Params: (True,)
|
|
34
|
+
|
|
35
|
+
# INSERT query
|
|
36
|
+
query = Q.insert_into("users").values([
|
|
37
|
+
{"name": "Alice", "email": "alice@example.com"}
|
|
38
|
+
])
|
|
39
|
+
sql, params = query.build()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
Full documentation is available in the [docs](docs/) directory.
|
|
45
|
+
|
|
46
|
+
- [Getting Started](docs/getting-started.md)
|
|
47
|
+
- [SELECT Queries](docs/select.md)
|
|
48
|
+
- [INSERT Queries](docs/insert.md)
|
|
49
|
+
- [UPDATE Queries](docs/update.md)
|
|
50
|
+
- [DELETE Queries](docs/delete.md)
|
|
51
|
+
- [JOIN Operations](docs/joins.md)
|
|
52
|
+
- [Condition Objects](docs/conditions.md)
|
|
53
|
+
- [Expressions & Functions](docs/expressions.md)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT License
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Documentation Index
|
|
2
|
+
|
|
3
|
+
sqlo documentation navigation.
|
|
4
|
+
|
|
5
|
+
## 📚 Documentation Structure
|
|
6
|
+
|
|
7
|
+
### 🚀 Getting Started
|
|
8
|
+
- **[Getting Started](getting-started.md)** - Installation, basic usage, core concepts
|
|
9
|
+
|
|
10
|
+
### 📖 Query Types
|
|
11
|
+
- **[SELECT Queries](select.md)** - Complete SELECT functionality (WHERE, ORDER BY, LIMIT, DISTINCT, UNION, etc.)
|
|
12
|
+
- **[INSERT Queries](insert.md)** - Single/batch inserts, INSERT IGNORE, ON DUPLICATE KEY UPDATE
|
|
13
|
+
- **[UPDATE Queries](update.md)** - UPDATE, SET, WHERE, LIMIT, ORDER BY
|
|
14
|
+
- **[DELETE Queries](delete.md)** - DELETE, WHERE, LIMIT, ORDER BY, safety best practices
|
|
15
|
+
|
|
16
|
+
### 🔧 SQL Features
|
|
17
|
+
- **[JOIN Operations](joins.md)** - INNER, LEFT, RIGHT, CROSS JOIN and performance optimization
|
|
18
|
+
- **[Condition Objects](conditions.md)** - Condition, ComplexCondition, AND/OR combinations
|
|
19
|
+
- **[Expressions & Functions](expressions.md)** - Raw SQL, Func, FunctionFactory, common functions
|
|
20
|
+
|
|
21
|
+
## 🎯 Find by Use Case
|
|
22
|
+
|
|
23
|
+
### I want to...
|
|
24
|
+
|
|
25
|
+
- **Query data** → [SELECT Queries](select.md)
|
|
26
|
+
- **Insert data** → [INSERT Queries](insert.md)
|
|
27
|
+
- **Update data** → [UPDATE Queries](update.md)
|
|
28
|
+
- **Delete data** → [DELETE Queries](delete.md)
|
|
29
|
+
- **Join multiple tables** → [JOIN Operations](joins.md)
|
|
30
|
+
- **Build complex conditions** → [Condition Objects](conditions.md)
|
|
31
|
+
- **Use SQL functions** → [Expressions & Functions](expressions.md)
|
|
32
|
+
- **Write raw SQL** → [Raw SQL Expressions](expressions.md#raw-sql-expressions)
|
|
33
|
+
|
|
34
|
+
## 🔗 Quick Links
|
|
35
|
+
|
|
36
|
+
### Common Features
|
|
37
|
+
- [Basic SELECT](select.md#basic-queries)
|
|
38
|
+
- [WHERE conditions](select.md#where-clauses)
|
|
39
|
+
- [JOIN tables](joins.md)
|
|
40
|
+
- [Batch inserts](insert.md#batch-insert)
|
|
41
|
+
- [Pagination](select.md#limit-and-offset)
|
|
42
|
+
|
|
43
|
+
### Advanced Features
|
|
44
|
+
- [Complex conditions](conditions.md#complex-combinations)
|
|
45
|
+
- [Subqueries](select.md#subqueries)
|
|
46
|
+
- [UNION](select.md#union)
|
|
47
|
+
- [Index Hints](select.md#index-hints)
|
|
48
|
+
|
|
49
|
+
### Security
|
|
50
|
+
- [Parameterized queries](getting-started.md#parameterized-queries)
|
|
51
|
+
- [SQL injection protection](expressions.md#safety-notes)
|
|
52
|
+
- [DELETE safety](delete.md#safety-best-practices)
|
|
53
|
+
|
|
54
|
+
## 🆘 Need Help?
|
|
55
|
+
|
|
56
|
+
1. **Check examples** - Each document contains rich code examples
|
|
57
|
+
2. **Search docs** - Use Ctrl+F to search for keywords
|
|
58
|
+
3. **Check tests** - `tests/unit/` directory contains more use cases
|
|
59
|
+
4. **Open an issue** - If you find problems or have suggestions
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
**Get started** → [Getting Started](getting-started.md)
|