Skip to main content

Python Basic Utilities - MySQL pbumysql

Available on PyPi

This package is still in development!

Table of Contents

  1. Installation
  2. Usage
  3. Classes
    1. AbstractMysqlStore - abstract class for handling MySQL table access
    2. AbstractMysqlDocument - abstract class for wrapping rows representing entities
    3. 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 of MysqlConnection
  • table_name - the name of the table containing the rows
  • object_class - used for all the query methods to deserialise the row into a class with attributes for easier access
  • logger - a logger instance with .info / .error / .warn methods available

Methods

TODO: describe methods

AbstractMysqlDocument

TODO: add documentation

MysqlConnection

TODO: add documentation

Release files for pbumysql 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pbumysql 0.1.0
File Size Uploaded
pbumysql-0.1.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pbumysql 0.1.0
File Interpreter ABI Platform
pbumysql-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / pbumysql-0.1.0.tar.gz

Download URL pbumysql-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b7883c2106743b0303bf4100fa1f984f424eb58f0359e90f695aa72f75a6a391
BLAKE2b-256 checksum
How to use checksums
b4a735ce0ef2315b028e6287b8e84794b6486416e9cd3583bf9e1bb43a7c2057
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pbumysql-0.1.0-py3-none-any.whl

Download URL pbumysql-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ede9a6dd64b354c265a95665bee57568f62b61f678bfaabc11a95a7eb0244139
BLAKE2b-256 checksum
How to use checksums
917b2523d96de21a303977eec5570f9008409b50bce3ff6270aac28b4b00b29b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page