https://github.com/imryche/litequery
A minimalist SQLite library for Python
https://github.com/imryche/litequery
aiohttp asyncio fastapi orm python python3 sql sqlite sqlite-database sqlite3 starlette
Last synced: 9 months ago
JSON representation
A minimalist SQLite library for Python
- Host: GitHub
- URL: https://github.com/imryche/litequery
- Owner: imryche
- License: mit
- Created: 2024-06-24T18:40:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T20:51:29.000Z (12 months ago)
- Last Synced: 2025-05-06T06:05:19.315Z (9 months ago)
- Topics: aiohttp, asyncio, fastapi, orm, python, python3, sql, sqlite, sqlite-database, sqlite3, starlette
- Language: Python
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Litequery
Litequery is a minimalist library for interacting with SQLite in Python. It lets
you define your queries once and call them as methods. No ORM bloat, just raw
SQL power, with the flexibility to operate in both asynchronous and synchronous
modes.
## Why Litequery?
- **Simplicity**: Define SQL queries in `.sql` files. No complex ORM layers.
- **Async first**: Built for modern async Python, but also supports synchronous
operations for traditional use cases.
- **Flexible**: Supports different SQL operations seamlessly.
## Installation
```
pip install litequery
```
## Getting Started
### Define Your Queries
Create a `queries.sql` file. Name your queries using comments and write them in
pure SQL.
```sql
-- name: get_all_users
SELECT * FROM users;
-- name: get_user_by_id^
SELECT * FROM users WHERE id = :id;
-- name: get_last_user_id$
SELECT MAX(id) FROM users;
-- name: insert_user