Skip to main content

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)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PoolDB-0.0.5.tar.gz (7.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

PoolDB-0.0.5-py3.6.egg (9.6 kB view details)

Uploaded Egg

PoolDB-0.0.5-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file PoolDB-0.0.5.tar.gz.

File metadata

  • Download URL: PoolDB-0.0.5.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for PoolDB-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7da1499d9126289df9ebc633c9492d758f9c7e053185758e24756a466e501609
MD5 3a509d3f3ff5f553b9c91f4628a6acea
BLAKE2b-256 e737800390faad2755ad4d9a9225790b8ac8951a3ed92509f35d68498120d899

See more details on using hashes here.

File details

Details for the file PoolDB-0.0.5-py3.6.egg.

File metadata

  • Download URL: PoolDB-0.0.5-py3.6.egg
  • Upload date:
  • Size: 9.6 kB
  • Tags: Egg
  • Uploaded using 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

File hashes

Hashes for PoolDB-0.0.5-py3.6.egg
Algorithm Hash digest
SHA256 da002d36e19775e49ddf660c3f0da0387499b3d941ef6bae2a23fcad6625b2d8
MD5 6b2f29077a13628ba988a828c95fd496
BLAKE2b-256 d09ecde2de90cec8df2f5fef8719f03383fdbe4e389d8eee0df57f14b38ffc0f

See more details on using hashes here.

File details

Details for the file PoolDB-0.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: PoolDB-0.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for PoolDB-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0e0c5e17191d638a2fedb9adbf7b3ba74c33e10aa389f5a08e36adbda523bf5e
MD5 8de1cc5dcc4f27b23cd5de83c129aeb9
BLAKE2b-256 58368d89565f66f91836c4807e7df9d5e266f036ac1b81fd166bdb574e44645b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.5 This release

3 files

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page