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")
Metadata
Release files for DBService 2.1.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 | |
|---|---|---|---|
| dbservice-2.1.3.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbservice-2.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / dbservice-2.1.3.tar.gz
| Download URL | dbservice-2.1.3.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73e7cf2a2d4b434f03d991fd6b20d7cca2b7482fa7fc631c8d0bed3fc8da5640
|
|
BLAKE2b-256 checksum How to use checksums |
5c6a91e4e7ac10af4f5a067b772d8849eb820814f511a2c84597927c03f3fe9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|
Release files / dbservice-2.1.3-py3-none-any.whl
| Download URL | dbservice-2.1.3-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e21bf9bed4783318551c0ccb6b4231dc14e4fdf25a125ce39e30ef3d8be8f25
|
|
BLAKE2b-256 checksum How to use checksums |
684e0b09de6c8972375511a54899da43d4f08687ecc9601ae8c0d5b0a1047732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|