Skip to main content

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 hashes)

Uploaded Source

Built Distribution

dbtool-0.2.0-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page