Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,40 @@ This
is a pure python distribution and - thus - should require no external
compilers or tools besides those contained within Python itself.

# Notes for this fork
# Project notes

- **Default storage:** this fork uses Parquet v2 files by default (via `pyarrow`) for improved I/O performance and reliability. If `pyarrow` is not available, it falls back to TinyDB's default JSON storage.
- **Default storage:** TinyMongo uses TinyDB's default JSON storage unless another backend is selected.
- **Optional storage backends:** Parquet v2, SQLite, and DuckDB backends are available.
- **Concurrency:** writes use atomic temp-file replace and optional advisory locks (`portalocker`) to reduce corruption risk under concurrent writers.
- **Tests & CI:** a GitHub Actions workflow is included at `.github/workflows/ci.yml` to run unit tests and linters across Python versions. See `requirements-dev.txt` for dev dependencies.


# Backend options

TinyMongo defaults to TinyDB's JSON storage:

```python
from tinymongo import TinyMongoClient

connection = TinyMongoClient("/path/to/folder")
```

You can select another backend with the `backend` argument:

```python
parquet_connection = TinyMongoClient("/path/to/folder", backend="parquet")
sqlite_connection = TinyMongoClient("/path/to/folder", backend="sqlite")
duckdb_connection = TinyMongoClient("/path/to/folder", backend="duckdb")
```

Available backends:

- `tinydb` or `json`: TinyDB's default JSON storage. This is the default and writes `.json` files.
- `parquet` or `parquetv2`: Parquet v2 storage backed by `pyarrow`. This writes `.parquet` files.
- `sqlite`: SQLite storage using Python's standard `sqlite3` module. This writes `.sqlite` files.
- `duckdb`: DuckDB storage. Install `duckdb` before using this backend. This writes `.duckdb` files.


# Examples

The quick start is shown below. For a more detailed look at tinymongo,
Expand Down
8 changes: 5 additions & 3 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ This guide helps you migrate from earlier `tinymongo` versions to `1.0.0`.
## Key changes

- The package now uses `pyproject.toml` for packaging metadata.
- Default storage is now Parquet v2 (`pyarrow`) instead of TinyDB JSON files.
- Default storage remains TinyDB JSON storage.
- Parquet v2, SQLite, and DuckDB are available as optional storage backends.
- Concurrent writes are safer due to atomic file replace and optional file locks.
- Optional `uv` extras are available for dependency-managed ASGI usage.

Expand All @@ -24,6 +25,7 @@ pip install .[uv]

## Notes

- The default storage uses Parquet and requires `pyarrow`.
- If `pyarrow` is not installed, `tinymongo` falls back to TinyDB JSON storage.
- The default storage uses TinyDB JSON storage.
- Parquet storage requires `pyarrow`; DuckDB storage requires `duckdb`.
- Select optional storage backends with `TinyMongoClient(path, backend="parquet")`, `backend="sqlite"`, or `backend="duckdb"`.
- For local development, install `requirements-dev.txt` and run `pytest -q`.
Loading