create sql query with the help of sql builder magic function help to make automatic sql query its help in build sql query string for Microsoft SQL, MySql, SqlLite, PostgreSQL, ORACLE, Apache Hive, Django, FLASK, HBASE and Apache Spark etc.
Project description
Universal SQL Builder
SQL framework ORM independent, it helps you build sql query in python
What ever you using Hive, HBase, Spark* SQL, Django & FLASK etc so you can gernate simple SQL query
Its return raw sql query string this can be use in any Framework
Installation
Clone or Download all file in your lib(any folder) and see in the example.pySelect
UniversalSqlBuilder.table("employee").select("id,name").select(",department").get()
Where
You can use key and value based parameters : where("city=", "ABC")Or you can use raw where query : where("col=(select id from users)")
UniversalSqlBuilder.table("employee").select("id,name").select(",department").where("ram=(select id from users)").where("city=", "delhi").get()
OrWhere and WhereBetween
If you want data according min and max use :
whereBetween("age",[200,300])
UniversalSqlBuilder.table("employee").select("id,name").whereBetween("age",[200,300]).get()
Using OR with where :
UniversalSqlBuilder.table("employee").select("id,name").orWhere("seller=",'100').get()
GroupBy, OrderBy amd Limit
Use of group by : groupBy("name")UniversalSqlBuilder.table("employee").select("id,name").groupBy("name").get()
Use order by : orderBy("ID","desc")
UniversalSqlBuilder.table("employee").select("id,name").orderBy("ID","desc").get()
use with limit : imit(10,20)
UniversalSqlBuilder.table("employee").select("id,name").limit(10,20).get()
Join ('FULL OUTER', 'INNER', 'LEFT', 'RIGHT', 'JOIN')
Default :
join("users","users.id=employee.emp_id")FULL OUTER : join("users","users.id=employee.emp_id","FULL OUTER")
INNER : join("users","users.id=employee.emp_id","INNER")
LEFT : join("users","users.id=employee.emp_id","LEFT")
RIGHT : join("users","users.id=employee.emp_id","RIGHT")
JOIN : join("users","users.id=employee.emp_id","JOIN")
Having & OrHaving
Using OR with Having :
UniversalSqlBuilder.table("employee").select("id,name").orHaving("seller=",'100').get()
You can use key and value based parameters : having("city=", "ABC")
Or you can use raw where query : having("col=(select id from users)")
UniversalSqlBuilder.table("employee").select("id,name").select(",department").having("id=(select id from users)").having("city=", "delhi").get()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file universal-sql-builder-0.0.2.tar.gz.
File metadata
- Download URL: universal-sql-builder-0.0.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cc64ee38a938683852c981d4bce1743646ec20bbce70d67c841c6f4de6fde81
|
|
| MD5 |
163c3697485a42b36cec402e071020c5
|
|
| BLAKE2b-256 |
f9524f5077c7d3fec5b47be7135e12acfda250419eb96bbc37192cb249bf6a91
|
File details
Details for the file universal_sql_builder-0.0.2-py3-none-any.whl.
File metadata
- Download URL: universal_sql_builder-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a067902be5af22abf884000a930251ec36f9e5d56a2f0b1d9e815378837f61b1
|
|
| MD5 |
199c8ef4ad8cc78b326e1827e81d80c4
|
|
| BLAKE2b-256 |
5a7a5cae4b5549de12ef89a8b9d637ede221dee9fde7fb7614053fe356864ad9
|