pypika.queries module¶
-
class
pypika.queries.
JoinOn
(item, how, criteria)[source]¶ Bases:
pypika.queries.Join
-
class
pypika.queries.
JoinUsing
(item, how, fields)[source]¶ Bases:
pypika.queries.Join
-
class
pypika.queries.
Query
[source]¶ Bases:
object
Query is the primary class and entry point in pypika. It is used to build queries iteratively using the builder design pattern.
This class is immutable.
-
classmethod
from_
(table)[source]¶ Query builder entry point. Initializes query building and sets the table to select from. When using this function, the query becomes a SELECT query.
Parameters: table – Type: Table or str
An instance of a Table object or a string table name.
:returns QueryBuilder
-
classmethod
into
(table)[source]¶ Query builder entry point. Initializes query building and sets the table to insert into. When using this function, the query becomes an INSERT query.
Parameters: table – Type: Table or str
An instance of a Table object or a string table name.
:returns QueryBuilder
-
classmethod
select
(*terms)[source]¶ Query builder entry point. Initializes query building without a table and selects fields. Useful when testing SQL functions.
Parameters: terms – Type: list[expression]
A list of terms to select. These can be any type of int, float, str, bool, or Term. They cannot be a Field unless the function
Query.from_
is called first.:returns QueryBuilder
-
classmethod
-
class
pypika.queries.
QueryBuilder
(quote_char='"', dialect=None, wrap_union_queries=True)[source]¶ Bases:
pypika.queries.Selectable
,pypika.terms.Term
Query Builder is the main class in pypika which stores the state of a query and offers functions which allow the state to be branched immutably.
-
columns
(*args, **kwargs)¶
-
delete
(*args, **kwargs)¶
-
distinct
(*args, **kwargs)¶
-
from_
(*args, **kwargs)¶
-
groupby
(*args, **kwargs)¶
-
having
(*args, **kwargs)¶
-
ignore
(*args, **kwargs)¶
-
insert
(*args, **kwargs)¶
-
into
(*args, **kwargs)¶
-
join
(*args, **kwargs)¶
-
limit
(*args, **kwargs)¶
-
offset
(*args, **kwargs)¶
-
orderby
(*args, **kwargs)¶
-
rollup
(*args, **kwargs)¶
-
select
(*args, **kwargs)¶
-
set
(*args, **kwargs)¶
-
union
(*args, **kwargs)¶
-
union_all
(*args, **kwargs)¶
-
update
(*args, **kwargs)¶
-
where
(*args, **kwargs)¶
-
-
class
pypika.queries.
Table
(name, schema=None, alias=None)[source]¶ Bases:
pypika.queries.Selectable