Easy to use, light weight ORM
Project description
Installation
To install pydb to your machine, run the following script from the root of your project's directory:
pip3 install pyDBMS
PyDBMS
Description: Pydb provides users with a light-weight, easy to use ORM(Object Relational Mapping) for multiple DBMS systems. The primary goal is to make communicating between databases as easy as possible using a unified base model type and abstract database interface. Pydb is designed to be easily extended to other languages as needed by the user.
Dependencies
When pydb is installed all libraries that will also be installed through pip. Pydb currently has no external dependencies until non-native databases are supported.
Usage
Models
Users have the ability to create their own custom models and seamlessly add them to their database of choice.
example_model.py
from pyDBMS import Model, Text, Float, Integer
class ExampleModel(Model):
__table_name__ = 'example_models'
__primary_keys__ = 'model_id' # alternatively ['model_id']
model_id = Text()
other_column = Integer()
another_column = Float()
Selecting Model Entries From The Database
Users may select entries from the database. They can use filters as seen below:
db = SQLiteDB('example.db')
results1 = db.select(ExampleModel, model_id='uuid(1)')
or
results2 = db.select(ExampleModel, other_column=[100,200], another_column=2.0)
or they can select all the models in the database of the given type with:
db = SQLiteDB('example.db')
all_example_models = db.select(ExamplModel)
Inserting And Updating Entries
Users can insert and update model entries across multiple databases with a uniform interface as seen below
local_db = SQLiteDB('local.db')
remote_db = PostgreSQLDB(host='http://db.example.com/',username='admin',password='password123')
# ************************
# process creating models
# ************************
model1 = ExampleModel(model_id='test_id',other_column=100)
local_db.insert(model1)
# same model can be used to upload to postgres DB
remote_db.insert(model1)
model1['another_column'] = 3.14
#update both db's
local_db.update(model1)
remote_db.update(model1)
Query Existing Databases Info
db = SQLiteDB('/location/for/database')
# list tables and columns
for table in db.tables():
print(table + ':')
for column in db.get_columns(table):
print(column)
How to test the software
Pydb is developed using Test-Driven Development. All the unittests can be run using the following command in the root directory:
python3 -m unittest discover
Known issues
Pydb currently only supports the Sqlite database as the requirements are being elicited.
Getting help
If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.
Getting involved
If you are interested in contributing fixes or features to MonoGame, please read our CONTRIBUTOR guide first.
Project details
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 pyDBMS-0.1.3.tar.gz.
File metadata
- Download URL: pyDBMS-0.1.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89918d38e4611ede244de4344329972d79315539ad72df994c925c5f28841866
|
|
| MD5 |
c9489f0ca8d197db73f71c2ff16968fd
|
|
| BLAKE2b-256 |
f7169ea613ebb49524589c512cb45d226ea50fc7021ff467d0a95da5ec792d0b
|
File details
Details for the file pyDBMS-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pyDBMS-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73e22c29a39c15a3cb6ef40cb235fbd02bfbd6ea5f831b930f39e0bacdb15b62
|
|
| MD5 |
74f3b05d9e51fd23269bbfba5c31fa1b
|
|
| BLAKE2b-256 |
2074a8f1218498a720e32c97c00adceebab3c32e33e1f8f31c256552217a6f37
|