Skip to main content

A MySQL class for more convenient database manipulations with Python dictionary.

Project description

PyPI page: https://pypi.python.org/pypi/dictmysql

Documentation: https://git.io/dictmysql

Introduction

DictMySQL is a MySQL query builder on the top of PyMySQL. It allows convenient database manipulation with Python dictionary.

DictMySQL simplifies and unifies the input/output of MySQL queries, by allowing passing values and conditions in dictionary into database. With DictCursor, you can even have a dict-in, dict-out mysql connector.

To install:

pip install dictmysql

Quick example:

from dictmysql import DictMySQL
db = DictMySQL(db='occupation', host='127.0.0.1', user='root', passwd='')

db.select(table='jobs',
          columns=['id','value'],
          where={'$OR': [{'value': {'$LIKE': 'Artist%'}}, {'id': 10}]})
# SELECT `id`, `value` FROM `jobs` WHERE (`value` LIKE "Artist%") OR (`id` = 10);

With DictCursor:

from dictmysql import DictMySQL, cursors
db = DictMySQL(db='occupation', host='127.0.0.1', user='root', passwd='',
               cursorclass=cursors.DictCursor)

db.select(table='jobs',
          columns=['id','value'],
          limit=2)
# returns [{u'id': 1, u'value': u'Artist'}, {u'id': 2, u'value': u'Engineer'}]

Future Works

  1. Full support of CRUD

  2. Better documents

License

DictMySQL uses the MIT license, see LICENSE file for the details.

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

dictmysql-0.6.8.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file dictmysql-0.6.8.tar.gz.

File metadata

  • Download URL: dictmysql-0.6.8.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dictmysql-0.6.8.tar.gz
Algorithm Hash digest
SHA256 2c27e39c26f633f9edd4c3326932ac26fed1de952216798806671be362d513d0
MD5 3414c5f7bfd6ca484ad5d0b0f3957b5e
BLAKE2b-256 f9f55e04b91b4424603340051e0d02f4cff770457faae490d4952ba2ccd2bbcd

See more details on using hashes here.

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