SimpleQuery¶
-
class
lsst.daf.butler.
SimpleQuery
¶ Bases:
object
A struct that combines SQLAlchemy objects.
Represents SELECT, FROM, and WHERE clauses.
Attributes Summary
from_
Return the FROM clause of the query ( sqlalchemy.sql.FromClause
).Methods Summary
combine
()Combine all terms into a single query object. copy
()Return a copy of this object. join
(table, *, onclause, isouter, full, **kwargs)Add a table or subquery join to the query. Attributes Documentation
-
from_
¶ Return the FROM clause of the query (
sqlalchemy.sql.FromClause
).This property cannot be set. To add tables to the FROM clause, call
join
.
Methods Documentation
-
combine
() → sqlalchemy.sql.selectable.Select¶ Combine all terms into a single query object.
Returns: - sql :
sqlalchemy.sql.Select
A SQLAlchemy object representing the full query.
- sql :
-
copy
() → lsst.daf.butler.core.simpleQuery.SimpleQuery¶ Return a copy of this object.
Returns the copy with new lists for the
where
andcolumns
attributes that can be modified without changing the original.Returns: - copy :
SimpleQuery
A copy of
self
.
- copy :
-
join
(table: sqlalchemy.sql.selectable.FromClause, *, onclause: Optional[sqlalchemy.sql.elements.ColumnElement] = None, isouter: bool = False, full: bool = False, **kwargs) → None¶ Add a table or subquery join to the query.
Possibly also adding SELECT columns or WHERE expressions at the same time.
Parameters: - table :
sqlalchemy.sql.FromClause
Table or subquery to include.
- onclause :
sqlalchemy.sql.ColumnElement
, optional Expression used to join the new table or subquery to those already present. Passed directly to
sqlalchemy.sql.FromClause.join
, but ignored if this is the first call toSimpleQuery.join
.- isouter :
bool
, optional If
True
, make this an LEFT OUTER JOIN. Passed directly tosqlalchemy.sql.FromClause.join
.- full :
bool
, optional If
True
, make this a FULL OUTER JOIN. Passed directly tosqlalchemy.sql.FromClause.join
.- **kwargs
Additional keyword arguments correspond to columns in the joined table or subquery. Values may be:
Select
(a special tag type) to indicate that this column should be added to the SELECT clause as a query result;None
to do nothing (equivalent to no keyword argument);- Any other value to add an equality constraint to the WHERE
clause that constrains this column to the given value. Note
that this cannot be used to add
IS NULL
constraints, because the previous condition forNone
is checked first.
- table :
-