dbwrapper
Note: this library is pre-alpha.
This version of dbwrapper is highly subject to change. Due to this, I won't be documenting a lot of the API. I tried to make the code fairly readable and code-suggestion friendly. I'm not planning on changing the structure of the major classes, but function arguments will definitely change and features will definitely be removed or addded.
dbwrapper is a lightweight python library designed to simplify interacting with databases of all kinds. This is not an ORM, and I have no plans to make it one. dbwrapper allows programmers to easily create queries using a fluent API. The primary focus of this library is to make data persistance database-agnostic while keeping query overhead low.
Supported Databases
- SQLite
- PostgreSQL
Databases with planned support
- SQL Server
- MySQL
- MongoDB
Features
- SELECT, UPDATE, INSERT, DELETE statements
- Table Creation (via a Builder)
- Migrations
- Note: Migrations are not automatically created, you have full control over these!
- List Tables
- List Table Columns
- 'Type Safe' Table and Column retreival
- Only the presence of tables & columns is validated. Verifying the datatype would incur too much overhead.
- Aliasing for Tables and Columns
- SQL Functions (partially implemented)
- Connection Pooling
- Built in logging and query profiling (just enable it using logging.basicConfig)
Simple Example Usage
from dbwrapper import sqlite # or postgresql
# If using PostgreSQL, the connection string will need to be changed
connection = sqlite.Connection("data.db")
db = connection.database(sqlite.MASTER_DB)
if "test" not in db.tables:
with db.table("test").builder() as builder:
builder.column("id", db.dtypes.integer)
builder.column("a", db.dtypes.varchar)
builder.column("b", db.dtypes.float)
builder.primary_key("id", autoincrement=True)
test = db.tables.test
test.delete().execute() # delete everthing
for i in range(5):
test.insert_one({
test.columns.a: "hello world!",
test.columns.b: i / 5
})
# no parameters for select() = all columns
results = test.select(
test.columns.id,
test.columns.a,
test.columns.b
) \
.where(test.columns.b <= 0.5) \
.execute()
print(results)
connection.close() # optional, but good practice
Metadata
Release files for dbwrapper-python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dbwrapper-python-0.1.1.tar.gz | 25.9 kB | Without provenance | Details for dbwrapper-python-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dbwrapper_python-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for dbwrapper_python-0.1.1-py3-none-any.whl |
Total release size: 58.6 kB
Release files / dbwrapper-python-0.1.1.tar.gz
| Download URL | dbwrapper-python-0.1.1.tar.gz |
|---|---|
| Size | 25.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74c9aea0a917dff663f1554ccd9800a6ce61f7ed51766cb87eb6b0d41977e487
|
|
BLAKE2b-256 checksum How to use checksums |
071e9fa4bffe7434093869537a82f0560e1da04b406f85928c5bbae8d2fe63de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
|
Release files / dbwrapper_python-0.1.1-py3-none-any.whl
| Download URL | dbwrapper_python-0.1.1-py3-none-any.whl |
|---|---|
| Size | 32.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b8b975eadd6b9869037bc5203c3d5d45676b763a5256a1d3c9091257ff84084
|
|
BLAKE2b-256 checksum How to use checksums |
07f2aa88d40ac510ea634f26f73436ea818ca3da4bf4c04d7685771a9182896b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
|
Security for dbwrapper-python 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.