A lightweight db tools for sql.
Project description
dbtool
A lightweight db tools for sql.
pip install dbtool
# sqlite3 ....
db = dbtool.connect('sqlite:///:memory:')
db = dbtool.connect('mysql://root:123456@127.0.0.1:3306/test', mincached=1, maxconnections=20)
# sql
db.execute(sql)
db.execute_fetchone(sql)
db.execute_cursor(sql)
db.execute_batch(sql)
db.execute_script(sql)
# crud
db.insert(user)
db.update(user)
db.delete(User, {'id': 1})
db.find(User, {'status': 1})
db.find_one(User, {'id': 1})
db.find_count(User, {'status': 1})
# transactions
with db.transaction():
db.execute(sql1)
db vs driver
- sqlite - sqlite3
- mysql - pymysql
- postgresql - psycopg2
- sqlserver - pymssql
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dbtool-0.2.0.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file dbtool-0.2.0.tar.gz
.
File metadata
- Download URL: dbtool-0.2.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.6 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a414f61c84d6032e8136513e886afc7eca2f92a1ec8e7f210de1b2e82d3eb5c8 |
|
MD5 | 8224b310f909c5f41dce0f36c6dbee58 |
|
BLAKE2b-256 | ae84ad993a7b089f12281063a8365c891c8df54caf5e3cd874f340903d2bfe77 |
File details
Details for the file dbtool-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: dbtool-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.6 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f4b7e01dd93db63a2337772af8b51dc49f20f0caf4deeaebb8fa19e7e5be69b |
|
MD5 | eca356c81aa283ddca9c02db0d7a1216 |
|
BLAKE2b-256 | 85de4cdf53e0ce23decb991fda01f720f1e2920302ec4bc595948a6094c30d13 |