Skip to main content

Build SQL with native Python data structure smoothly.

Project description

https://travis-ci.org/moskytw/mosql.png

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

MoSQL — More than SQL

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

  1. Easy-to-learn — Everything is just a plain Python object or SQL keyword.

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

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

  4. Fast — It simply translates the Python data structures into SQLs.

It is just more than SQL.

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

Check The Common Queries — mosql.query for detail, or there are examples which interact with real database.

Like it?

It is available on PyPI:

$ 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.12.1.tar.gz (38.3 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for mosql-0.12.1.tar.gz
Algorithm Hash digest
SHA256 ac3cc78cd89da269537227b49942abe7af684b0a70ee2a459f8d452e823798c7
MD5 3f74929ec77faa121371bb5c42ac5c35
BLAKE2b-256 745a67af007d56da1ec396ee7b84724e0b2b04cd4ef6558fc099e43f4965dd84

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