Python SQL query generator
Project description
EasySQL
Overview
EasySQL is a dependency-free, pythonic module to make your SQL projects easy and fast
To install EasySQL, simply use pip install easysql
.
To view examples, look in examples.py
, or continue reading for a more extensive description.
Conditionals
Conditionals can be imported directly from easysql
.
from easysql import SQLConditional
Conditionals are initiated with a string representation of a condition.
from easysql import SQLConditional as sqc
condition = sqc("age > 17")
To join conditionals, use &, |, ~
for AND, OR, NOT
, respectively. When compared, a new conditional is returned.
from easysql import SQLConditional as sqc
condition = sqc("age > 17")
condition2 = sqc("age < 100")
condition3 = condition & condition2 # AND
condition4 = condition | condition2 # OR
condition5 = ~condition # NOT
Queries
Queries are inititated with the query type of the Query, the args for the type, and inititated from a DBType or with a DBType as a param.
from easysql import DBType, Query
db = DBType("<db name>")
Q_param = Query("<type>", <args>, db=db) # With DBType as a parameter
Q_method = db.query("<type>", <args>) # From DBType method
Queries currently have the following types:
WIP
select -- SQL SELECT method. Params: column_names, table_name, constraints=None
delete -- SQL DELETE method. Params: table_name, constraints=None
update -- SQL UPDATE method. Params:
insert -- SQL INSERT method. Params:
table -- SQL CREATE TABLE method. Params:
selectdistinct -- SQL SELECT DISTINCT method. Params:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file easysql-1.0.1.tar.gz
.
File metadata
- Download URL: easysql-1.0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e3c91beaab7567448ed012bfbad72861e36951d8e536f4642144d2b00bd3d63 |
|
MD5 | c0b5922cf31b440862565368a9a59ad0 |
|
BLAKE2b-256 | 01dbff436af117dbccf3fb6bbdd27521a78a4263567a6d26c0189725383beb5b |
File details
Details for the file easysql-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: easysql-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2084c318dc695359ab2b531f2287807ab3ad933010cc6a2a526c44ae0f7e0578 |
|
MD5 | 68b330ef1cfbe9b20b108f8c681f3988 |
|
BLAKE2b-256 | aae573e719f45da2c50cf0ea6be08a86b07ae98272cd4b1ad9766683523f230f |