Basic MySQL wrapper for object-oriented collection handling
Project description
Python Basic Utilities - MySQL pbumysql
Available on PyPi
This package is still in development!
Table of Contents
- Installation
- Usage
- Classes
- AbstractMysqlStore - abstract class for handling MySQL table access
- AbstractMysqlDocument - abstract class for wrapping rows representing entities
- MysqlConnection - a wrapper for a MySQL connection
Installation
Install via pip:
pip install pbumysql
Usage
It is good practice associating a sub-class of AbstractMysqlDocument
with a sub-class of AbstractMysqlStore
. This is
done through the object_class
parameter in the super()
constructor call of the store class. Any method for querying
rows will use that class to deserialise the row into the provided class, which should extend AbstractMysqlDocument
.
Example: let's say we want to implement access to a collection containing user documents. We'll define a class User
that extends AbstractMysqlDocument
and a class UserStore
that extends AbstractMysqlStore
.
- TODO: add code example of store and entity definition
- TODO: add code example of store and entity usage
Classes
AbstractMysqlStore
This is an abstract class and cannot be instantiated directly. Instead, define a class that extends this class.
Constructor
__init__(connection, table_name, object_class, logger=None)
connection
- an instance ofMysqlConnection
table_name
- the name of the table containing the rowsobject_class
- used for all the query methods to deserialise the row into a class with attributes for easier accesslogger
- a logger instance with.info
/.error
/.warn
methods available
Methods
TODO: describe methods
AbstractMysqlDocument
TODO: add documentation
MysqlConnection
TODO: add documentation
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
File details
Details for the file pbumysql-0.1.0.tar.gz
.
File metadata
- Download URL: pbumysql-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7883c2106743b0303bf4100fa1f984f424eb58f0359e90f695aa72f75a6a391 |
|
MD5 | bbe2b5e738f5494b38955c8122703525 |
|
BLAKE2b-256 | b4a735ce0ef2315b028e6287b8e84794b6486416e9cd3583bf9e1bb43a7c2057 |
File details
Details for the file pbumysql-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pbumysql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede9a6dd64b354c265a95665bee57568f62b61f678bfaabc11a95a7eb0244139 |
|
MD5 | 4ba41888d91149d72f1be667690eec22 |
|
BLAKE2b-256 | 917b2523d96de21a303977eec5570f9008409b50bce3ff6270aac28b4b00b29b |