An open API service indexing awesome lists of open source software.

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

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