database-connector-kit
This python module handles any type of databases connection(s) using a yaml configuration file.
It is a fork coming from fastapi-framework-mvc and flask-framework-mvc.
Created for better package management in between both projects.
Can be loaded standalone outside its original projects.
Default database with builtin driver in sqlalchemy
...
DATABASES:
default: mysql
mysql:
driver: mysql+pymysql
user: "replace this with your database user"
password: "replace this with your database user's password"
database: "replace this with your database name"
address: "replace this with your hostname"
models: "mysql (python module that require to be put under models.persistent module, non blocking if module doesn't exist)"
readonly: false
...
Default database with non builtin driver in sqlalchemy
...
DATABASES:
informix:
driver: informix
user: "replace this with your database user"
password: "replace this with your database user's password"
database: "replace this with your database name"
address: "replace this with your hostname"
models: "informix (python module that require to be put under models.persistent module, non blocking if module doesn't exist)"
params:
SERVER: "replace with your server name"
CLIENT_LOCALE: "replace with your client locale"
DB_LOCALE: "replace with your server locale"
dialects:
informix:
module: IfxAlchemy.IfxPy
class: IfxDialect_IfxPy
informix.IfxPy:
module: IfxAlchemy.IfxPy
class: IfxDialect_IfxPy
informix.pyodbc:
module: IfxAlchemy.pyodbc
class: IfxDialect_pyodbc
readonly: false
...
or:
...
DATABASES:
bigquery:
driver: bigquery
user: "replace this with your database user"
password: "replace this with your database user's password"
database: "replace this with your database name"
address: "replace this with your hostname"
models: "bigquery (python module that require to be put under models.persistent module)"
readonly: false
engine:
location: US
...
dialects, params and engine are non mandatory within the yaml config file.
dialects are for registering database dialects base what the python database lib provides.
params are for putting additional params within the database url link used when sqlalchemy create_engine function is called
engine is all other arguments that can be given to the sqlalchemy create_engine function
Loading configuration
In order to load it you need to create a yaml configuration file with entries as described on sections bellow. This yaml configuration files can have environment variable within encapsuled in ${ENVIRONMENT_NAME} syntax.
import os
from database_connector_kit.config import Environment
Environment.load('config.yml')
Usage
After loading the configuration file, you can create the database's connection(s) by:
from database_connector_kit import Driver
Driver.register_engines()
Driver.init()
There is a safe decorator that enable some sqlalchemy errors to be dealt with and retry reprocessing the function that handles database operations. In order to use it, use de following example:
from database_connector_kit import safe
@safe
def func():
"""
Function that update, select, insert ot even delete contents from the database
"""
pass
Metadata
Release files for database-connector-kit 1.0.3
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 |
|---|---|---|---|---|
| database_connector_kit-1.0.3.tar.gz | 46.7 kB | Without provenance | Details for database_connector_kit-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| database_connector_kit-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for database_connector_kit-1.0.3-py3-none-any.whl |
Total release size: 82.5 kB
Release files / database_connector_kit-1.0.3.tar.gz
| Download URL | database_connector_kit-1.0.3.tar.gz |
|---|---|
| Size | 46.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd8529f31c342abc0fe7739737161bb77ee77fb32caf05173d69f86a424049fa
|
|
BLAKE2b-256 checksum How to use checksums |
681ffeb19d4415822b02d35483af1c4c8b38a6f4962966e4845d1fdf111315b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / database_connector_kit-1.0.3-py3-none-any.whl
| Download URL | database_connector_kit-1.0.3-py3-none-any.whl |
|---|---|
| Size | 35.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
181814a9ed61ae93c54d760de0bb8d82fb0ef3e3d7e488083d97537e17c67712
|
|
BLAKE2b-256 checksum How to use checksums |
24968257d56dd292b141edf617d9b99a8113bffe03c002aedaa5078f2f406f71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for database-connector-kit 1.0.3
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.