PoolDB
python数据库连接池管理,支持并发获取sql数据,自动管理数据库连接,支持with语句,支持sql字典访问形式获取数据等
- 原生sql获取数据
db_url = 'postgresql+psycopg2://xxx:xxx@xxx:5433/xxx?utf-8'
pool = PoolDB(db_url=db_url)
conn = pool.connect()
result = conn.execute(text("select * from xx.xx limit :limit"), limit=5)
while 1:
try:
r = next(result)
print(r)
print(r.xx)
except:
break
pool.close(conn)
- 并发获取数据库数据
db_url = 'postgresql+psycopg2://xx:xx@xx:xx/xx?utf-8'
pool = PoolDB(db_url=db_url)
sqls = ["select * from xx.xx limit 5", "select * from xx.xx limit 4"]
gv = pool.multi_data(sql=sqls) # 多条数据并发获取,
for v in gv:
print(v)
- 字典形式访问获取数据库数据, key为sql或sql列表
db_url = 'postgresql+psycopg2://xx:xx@xx:xx/xx?utf-8'
pool = PoolDB(db_url=db_url)
r = pool["select * from xxx.xxx limit 5"]
print(r)
sqls = ["select * from xx.xx limit 5", "select * from xx.xx limit 4"]
r_list = pool[sqls]
print(r_list)
Metadata
Release files for PoolDB 0.0.5
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 |
|---|---|---|---|---|
| PoolDB-0.0.5.tar.gz | 7.0 kB | Without provenance | Details for PoolDB-0.0.5.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PoolDB-0.0.5-py3.6.egg | Legacy Egg format | - | - | Details for PoolDB-0.0.5-py3.6.egg |
| PoolDB-0.0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for PoolDB-0.0.5-py2.py3-none-any.whl |
Total release size: 23.0 kB
Release files / PoolDB-0.0.5.tar.gz
| Download URL | PoolDB-0.0.5.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7da1499d9126289df9ebc633c9492d758f9c7e053185758e24756a466e501609
|
|
BLAKE2b-256 checksum How to use checksums |
e737800390faad2755ad4d9a9225790b8ac8951a3ed92509f35d68498120d899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
|
Release files / PoolDB-0.0.5-py3.6.egg
| Download URL | PoolDB-0.0.5-py3.6.egg |
|---|---|
| Size | 9.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
da002d36e19775e49ddf660c3f0da0387499b3d941ef6bae2a23fcad6625b2d8
|
|
BLAKE2b-256 checksum How to use checksums |
d09ecde2de90cec8df2f5fef8719f03383fdbe4e389d8eee0df57f14b38ffc0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
|
Release files / PoolDB-0.0.5-py2.py3-none-any.whl
| Download URL | PoolDB-0.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0e0c5e17191d638a2fedb9adbf7b3ba74c33e10aa389f5a08e36adbda523bf5e
|
|
BLAKE2b-256 checksum How to use checksums |
58368d89565f66f91836c4807e7df9d5e266f036ac1b81fd166bdb574e44645b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
|
Security for PoolDB 0.0.5
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.