a Database Wrapper for Redis and MySQL
Project description
a Database Wrapper for Redis and MySQL
from DBService import MysqlService
mysql_server = MysqlService(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_DB)
# query
mysql_server.query("SELECT * FROM TABLE")
# execute
mysql_server.execute("UPDATE from TABLES SET a = 55 WHERE id = 1")
# transaction
mysql_server.query(["UPDATE from TABLES SET a = 55 WHERE id = 1","UPDATE from TABLES SET a = 545 WHERE id = 2"])
from DBService import RedisService
redis_server = RedisService("redis://:user@host:port/db")
from DBService import PgsqlService
pgsql_server = PgsqlService(PGSQL_HOST, PGSQL_USER, PGSQL_PASSWORD, PGSQL_PORT, PGSQL_DB)
# query
pgsql_server.query("SELECT * FROM TABLE")
# execute
pgsql_server.execute("UPDATE from TABLES SET a = 55 WHERE id = 1")
# transaction
pgsql_server.query(["UPDATE from TABLES SET a = 55 WHERE id = 1","UPDATE from TABLES SET a = 545 WHERE id = 2"])
also support async,use them just add 'await'
from DBService import AsyncRedisService,AsyncMysqlService,AsyncPgsqlService
redis_server = AsyncRedisService("redis://:user@host:port/db")
mysql_server = AsyncMysqlService(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_DB)
pgsql_server = AsyncPgsqlService(PGSQL_HOST, PGSQL_USER, PGSQL_PASSWORD, PGSQL_PORT, PGSQL_DB)
# or pgsql_server = AsyncPgsqlService(dsn="postgresql://username:password@localhost:5432/mydatabase")
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
dbservice-2.1.3.tar.gz
(14.2 kB
view details)
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
dbservice-2.1.3-py3-none-any.whl
(14.4 kB
view details)
File details
Details for the file dbservice-2.1.3.tar.gz.
File metadata
- Download URL: dbservice-2.1.3.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73e7cf2a2d4b434f03d991fd6b20d7cca2b7482fa7fc631c8d0bed3fc8da5640
|
|
| MD5 |
201f1868a971f1719e81ec4bd90b475d
|
|
| BLAKE2b-256 |
5c6a91e4e7ac10af4f5a067b772d8849eb820814f511a2c84597927c03f3fe9e
|
File details
Details for the file dbservice-2.1.3-py3-none-any.whl.
File metadata
- Download URL: dbservice-2.1.3-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e21bf9bed4783318551c0ccb6b4231dc14e4fdf25a125ce39e30ef3d8be8f25
|
|
| MD5 |
90412a8cb2afaffaf1b65f4ae8660268
|
|
| BLAKE2b-256 |
684e0b09de6c8972375511a54899da43d4f08687ecc9601ae8c0d5b0a1047732
|