ZCrypto Wrapper
ZPy Database Core
Zurck'z Py
This package contains some helpers features for encrypt data .
ZPy use the following packages:
- pycrypto
Requirements
- Python 3.6+
Installation
Use the package manager pip to install py flask micro service core .
pip install zpy
pip install package_directory directory_to_install
Features
Contains some helper features with specific integrations.
- Database
- Only MySQL implementation
- Functions executor
- Stored Procedures executor
- Autocommit is false by default
- Only MySQL implementation
- Utils
- funcs
Roadmap
- ActiveRecord implementation
- Cluster
Basic Usage
Basic Configuration
config = {
"user": "",
"password": "",
"database": "",
"host": "",
"port": 3306
}
With single datasource
# Create database mediator with single datasource
db_manager = ZMediator.single(config, True)
# Open connection
db_conn = db_manager.default().new_connect()
try:
# Execute function
res = db_manager.default().exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
print(res)
except Exception as e:
logging.exception(e)
finally:
# ⚠ Remember close opened connection
db_conn.close()
Multiple Datasources
# Define db mediator
# Setup base configuration in ZMediator()
# The base configuration will be overwritten by add common values
db_mngr = ZMediator(config, False)
.add_common("DB_NAME_1", "DB_USER", "DB_PASSWORD", True) # Mark default ds
.add_common("DB_NAME_2", "DB_USER", "DB_PASSWORD")
.add_common("DB_NAME_3", "DB_USER", "DB_PASSWORD")
db_conn1 = db_mngr.default().new_connect()
db_conn2 = db_mngr.get("DB_NAME_1").new_connect()
db_conn3 = db_mngr.get("DB_NAME_3").new_connect()
try:
# Execute function
res = db_mngr.default().exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
print(res)
# Execute function
res = db_mngr.get("DB_NAME_2").exec("FN_GET_USER_BY_ID(%d)", list_params=[1], ret_type=DBTypes.cursor)
print(res)
# Call sp
res = db_mngr.get("DB_NAME_3").call("SP_GET_DATA", ret_type=DBTypes.cursor)
print(res)
except Exception as e:
logging.exception(e)
finally:
# ⚠ Remember close opened connections
db_conn1.close()
db_conn2.close()
db_conn3.close()
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Authors
Release files for zpy-ciphers-utils 0.0.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 | |
|---|---|---|---|
| zpy-ciphers-utils-0.0.1.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zpy_ciphers_utils-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / zpy-ciphers-utils-0.0.1.tar.gz
| Download URL | zpy-ciphers-utils-0.0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6609bfc1dbad1e38773367776e46e8467a531a0e1f6b9be5411fd6bee6abe4e2
|
|
BLAKE2b-256 checksum How to use checksums |
3f9f3d5b61fe96d75332f9524dee28df46ebcd61148301a1395e74cbcf58d83c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5
|
Release files / zpy_ciphers_utils-0.0.1-py3-none-any.whl
| Download URL | zpy_ciphers_utils-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
984b1a35a37899bb4eeb1427026344464489bbc5355355e3d6207248c2700e70
|
|
BLAKE2b-256 checksum How to use checksums |
dc424d6fbf5ae47d3da509ea50d49247cbfbb6f2b13a3073bb715dd6cb645b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5
|