SQL ( Q )
table
table
is short for Model.objects
Methods
Querying
Simplified SQL Querying
Where
table.Q.where("id", "in", [1, 2, 3])
Filter-By
WHERE id = 1 AND name = "spongebob" AND last_name = "squarepants"
table.Q.filter_by(id=1, name="spongebob", last_name="squarepants")
Search
WHERE name = "bob" OR name = "bob"
table.Q.search(["name", "nickname"], "bob")
Compile
Compiling
Compiling the Query.
Normal (Select)
# Query
query = table.Q.search(["name", "title"], "bob")
# Compile
table.Q.select(query)
# Query
query = table.Q.filter_by(name="bob")
# Compile
table.Q.find(
query, # The Query
page = 1, # Current Page
limit = 100, # Items Per Page
sort_by = '-id' # Sort-By "X" Column
)