Skip to main content

SQL Query Builder inspired on django ORM Syntax

Project description

SQL Query Builder based on django ORM

What's that?

Is a library that you can use to build sql queries if your are accustomed to use Django ORM

How to use

There are 3 main objects Q, QuerySet and SQLModel.

Using it
.. code-block:: python

from sqlbuilder import SQLModel, Queryset, Q

class Client(SQLModel):
table = "clients"


.. code-block:: python

sql = Queryset("clients").filter(name="Jhon").exclude(lastname="Doe").group_by("family")

sql = Client.objects.filter(Q(name="John") & ~Q(lastname="Doe"))


qs = Queryset("users")\
.order_by( "nombre", "-fecha")\

"SELECT * FROM users WHERE ((nombre='jose') AND (fecha<=now())) ORDER BY nombre, fecha DESC LIMIT 10"

str(sql) will result an string with the sql generated

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlquerybuilder, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size sqlquerybuilder-0.0.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page