• Stars
    star
    140
  • Rank 259,979 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Build SQL with native Python data structure smoothly.

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

More Repositories

1

zipcodetw

Find Taiwan ZIP code by address fuzzily.
Python
281
star
2

uniout

Never see escaped bytes in output.
Python
158
star
3

clime

DEPRECATION: Convert functions into multi-command program breezily.
Python
151
star
4

mosky-mini-configs

The configs just work. ✨
Shell
91
star
5

hypothesis-testing-with-python

True difference or noise? πŸ“Š
Jupyter Notebook
70
star
6

mosky.vim

DEPRECATE: This repo is merged into moskytw/mosky-mini-configs.
Vim Script
47
star
7

elegant-concurrency-lab

Make concurrency elegant with channels.
Python
43
star
8

practicing-python-3

Learn Python from zero to intermediate! πŸš€
Jupyter Notebook
37
star
9

data-science-with-python

Introduce data science in plain Python. πŸ§ͺ
Jupyter Notebook
35
star
10

git-count

Python
28
star
11

revivalkit

Python
26
star
12

slak

Collect data from Slack like a pro. ⚑️
Python
24
star
13

statistical-regression-with-python

Explain & predict! πŸ“ˆ
Jupyter Notebook
15
star
14

postbox

Python
13
star
15

mining-ptt-news

What kind of news will be voted down on PTT?
Jupyter Notebook
13
star
16

luthadel.vim

A simple but ardent Vim color scheme.
Vim Script
11
star
17

nginx-contrib-vim

Make Vim have better nginx.conf support.
Vim Script
9
star
18

enhancedyaml

Python
8
star
19

cython-lab

Python
7
star
20

uwsgi-emperor

7
star
21

coding-is-magic

Magic! ✨
Jupyter Notebook
5
star
22

examples-for-learning-python-from-data

Python
4
star
23

concurrency-lab

Python
4
star
24

memo-app

JavaScript
4
star
25

multi-celeryd

4
star
26

tacit

Python
2
star
27

snack

Python
1
star
28

tagit.vim

It is a vim plugin handles tags in background. Let you enjoy the benfits of tags without addational effort.
Vim Script
1
star
29

vim-color-scheme-template-generator

Generate Vim's color scheme template precisely.
Python
1
star
30

examples-for-programming-with-python

Python
1
star