Asynchronous fake PostgreSQL and MongoDB interfaces backed by local or remote storage.
Project description
fakedb
fakedb oferece implementações assíncronas de bancos de dados fake inspirados
em PostgreSQL e MongoDB, persistindo dados em sistemas de arquivos locais ou em
backends compatíveis com Google Cloud Storage. Ele é útil para protótipos,
testes e ambientes onde provisionar um banco real seria custoso ou demorado.
Recursos principais
FakePostgresDB: API parecida com SQLAlchemy/SQLModel, com suporte opcional a validação por Pydantic e materialização de resultados em modelos tipados.FakeMongoDB: coleções estilo MongoDB com binding opcional a modelos Pydantic.- Backends plugáveis via
StorageBackend, incluindo uma implementação local e uma variante para GCS. - Locking distribuído simples para coordenar operações concorrentes.
Instalação
pip install fakedb
Dependências opcionais:
pip install "fakedb[extras]" # Pydantic, SQLModel, SQLAlchemy
pip install "fakedb[cloud]" # google-cloud-storage
Exemplos rápidos
import asyncio
from fakedb import FakePostgresDB, LocalStorageBackend
async def demo():
backend = LocalStorageBackend("/tmp/fake-db")
db = FakePostgresDB(backend, "analytics")
await db.create_table("users", {"id": "int", "name": "str"})
await db.insert("users", [{"id": 1, "name": "Alice"}])
rows = await db.query("users")
print(rows)
asyncio.run(demo())
Desenvolvimento
make test # executa a suíte com pytest
make coverage # relatórios de cobertura
Sinta-se à vontade para abrir issues e PRs com melhorias.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakedb-0.1.0.tar.gz.
File metadata
- Download URL: fakedb-0.1.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c6fb855467006e769ecb9f2c5aad4bded51eb0099b4efb4b4aacbd48c3e7152
|
|
| MD5 |
17f4588454520f1fa22037fa892abd96
|
|
| BLAKE2b-256 |
770f510a6c89841c2d4c63e121306a2894452c47d2de57a1a181d78f1a548dde
|
File details
Details for the file fakedb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fakedb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35ecd65431877afe5b9c128e3416613431e5ea97456ea24df29c48e965fd8c9e
|
|
| MD5 |
e0ecb3de1c799312df07be479972c070
|
|
| BLAKE2b-256 |
0ffd92f857000094098c11673515490ad49964b3a1720dc5b415eb2daf5a0785
|