Skip to main content

Build SQL with native Python data structure smoothly.

Project description

https://travis-ci.org/moskytw/mosql.png https://pypip.in/v/mosql/badge.png https://pypip.in/d/mosql/badge.png

The full version of this documentation is at mosql.mosky.tw.

MoSQL — More than SQL

It lets you use the common Python’s data structures to build SQLs. Here are the main features:

  1. Easy-to-learn — Everything is just plain data structure or SQL keyword.

  2. Flexible — The queries it builds fully depends on the structure you provide.

  3. Secure — It prevents the SQL injection from both identifier and value.

  4. Fast — It just builds the SQLs from Python’s data structures.

It is just more than SQL.

Some of the modules are deprecated after v0.6, check The Modules Deprecated after v0.6 for more information.

MoSQL is Elegant

Here we have a dictionary which includes the information of a person:

>>> mosky = {
...    'person_id': 'mosky',
...    'name'     : 'Mosky Liu',
... }

And we want to insert it into a table named person. It is easy with mosql.query.

>>> from mosql.query import insert
>>> print insert('person', mosky)
INSERT INTO "person" ("person_id", "name") VALUES ('mosky', 'Mosky Liu')

You can check The Common Queries — mosql.query for the detail usage, or there are also many examples which really interact with database.

Like it?

It is easy to install MoSQL with pip:

$ sudo pip install mosql

Or clone the source code from Github:

$ git clone git://github.com/moskytw/mosql.git

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

mosql-0.8.tar.gz (33.0 kB view details)

Uploaded Source

File details

Details for the file mosql-0.8.tar.gz.

File metadata

  • Download URL: mosql-0.8.tar.gz
  • Upload date:
  • Size: 33.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mosql-0.8.tar.gz
Algorithm Hash digest
SHA256 1669d6a6fa1fe43f3a3bd4dc2de96384f90d13df9e3e197234fb2b24f0f7d2f6
MD5 7d834cfc48e27f09e8f76e5007c4d58f
BLAKE2b-256 59f03a73d39cdf5526b840e66ed5d06003af77b54e719ae01ab52c2ffb14bfbf

See more details on using hashes here.

Provenance

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