Skip to content

bmoyles0117/EasySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasySQL

This library's purpose is to remove the need to manually build a SQL query as a string with multiple conditions of potential WHERE, ORDER, LIMIT, or any other kind of statement.

import easysql, random

select = easysql.Select().from_('my_table', ['*']).limit(20)

this_is_awesome = random.randint(0, 10) > 5

if this_is_awesome:
    select = select.where('my_column = %s', 'awesome')
else:
    select = select.order_by('my_column ASC')

print select

We can all hope that 50% of the time we will see something like...

SELECT my_table.* FROM my_table WHERE my_column = "awesome" LIMIT 20

and that the other 50% of the time we will certainly see

SELECT my_table.* FROM my_table ORDER BY my_column ASC LIMIT 20

About

Select queries in SQL made easy for python!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages