pyfarm.master.user_interface.jobs module¶
-
pyfarm.master.user_interface.jobs.
asc
(column)¶ Produce an ascending
ORDER BY
clause element.e.g.:
from sqlalchemy import asc stmt = select([users_table]).order_by(asc(users_table.c.name))
will produce SQL as:
SELECT id, name FROM user ORDER BY name ASC
The
asc()
function is a standalone version of theColumnElement.asc()
method available on all SQL expressions, e.g.:stmt = select([users_table]).order_by(users_table.c.name.asc())
Parameters: column – A ColumnElement
(e.g. scalar SQL expression) with which to apply theasc()
operation.
-
pyfarm.master.user_interface.jobs.
desc
(column)¶ Produce a descending
ORDER BY
clause element.e.g.:
from sqlalchemy import desc stmt = select([users_table]).order_by(desc(users_table.c.name))
will produce SQL as:
SELECT id, name FROM user ORDER BY name DESC
The
desc()
function is a standalone version of theColumnElement.desc()
method available on all SQL expressions, e.g.:stmt = select([users_table]).order_by(users_table.c.name.desc())
Parameters: column – A ColumnElement
(e.g. scalar SQL expression) with which to apply thedesc()
operation.
-
pyfarm.master.user_interface.jobs.
distinct
(expr)¶ Produce an column-expression-level unary
DISTINCT
clause.This applies the
DISTINCT
keyword to an individual column expression, and is typically contained within an aggregate function, as in:from sqlalchemy import distinct, func stmt = select([func.count(distinct(users_table.c.name))])
The above would produce an expression resembling:
SELECT COUNT(DISTINCT name) FROM user
The
distinct()
function is also available as a column-level method, e.g.ColumnElement.distinct()
, as in:stmt = select([func.count(users_table.c.name.distinct())])
The
distinct()
operator is different from theSelect.distinct()
method ofSelect
, which produces aSELECT
statement withDISTINCT
applied to the result set as a whole, e.g. aSELECT DISTINCT
expression. See that method for further information.See also
ColumnElement.distinct()
Select.distinct()
func
-
pyfarm.master.user_interface.jobs.
or_
(*clauses)¶ Produce a conjunction of expressions joined by
OR
.E.g.:
from sqlalchemy import or_ stmt = select([users_table]).where( or_( users_table.c.name == 'wendy', users_table.c.name == 'jack' ) )
The
or_()
conjunction is also available using the Python|
operator (though note that compound expressions need to be parenthesized in order to function with Python operator precedence behavior):stmt = select([users_table]).where( (users_table.c.name == 'wendy') | (users_table.c.name == 'jack') )
See also