pypika.queries module¶
-
class
pypika.queries.AliasedQuery(name, query=None)[source]¶ Bases:
pypika.queries.Selectable
-
class
pypika.queries.CreateQueryBuilder(dialect=None)[source]¶ Bases:
objectQuery builder used to build CREATE queries.
-
ALIAS_QUOTE_CHAR= None¶
-
QUOTE_CHAR= '"'¶
-
SECONDARY_QUOTE_CHAR= "'"¶
-
as_select(*args, **kwargs)¶
-
columns(*args, **kwargs)¶
-
create_table(*args, **kwargs)¶
-
temporary(*args, **kwargs)¶
-
-
class
pypika.queries.Database(name, parent=None)[source]¶ Bases:
pypika.queries.Schema
-
class
pypika.queries.JoinOn(item, how, criteria, collate=None)[source]¶ Bases:
pypika.queries.Join-
replace_table(*args, **kwargs)¶
-
-
class
pypika.queries.JoinUsing(item, how, fields)[source]¶ Bases:
pypika.queries.Join-
replace_table(*args, **kwargs)¶
-
-
class
pypika.queries.Query[source]¶ Bases:
objectQuery 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
create_table(table)[source]¶ Query builder entry point. Initializes query building and sets the table name to be created. When using this function, the query becomes a CREATE statement.
Parameters: table – An instance of a Table object or a string table name. Returns: CreateQueryBuilder
-
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(dialect=None, wrap_union_queries=True, wrapper_cls=<class 'pypika.terms.ValueWrapper'>)[source]¶ Bases:
pypika.queries.Selectable,pypika.terms.TermQuery 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.
-
ALIAS_QUOTE_CHAR= None¶
-
QUOTE_CHAR= '"'¶
-
SECONDARY_QUOTE_CHAR= "'"¶
-
columns(*args, **kwargs)¶
-
delete(*args, **kwargs)¶
-
distinct(*args, **kwargs)¶
-
force_index(*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)¶
-
prewhere(*args, **kwargs)¶
-
replace(*args, **kwargs)¶
-
replace_table(*args, **kwargs)¶
-
rollup(*args, **kwargs)¶
-
select(*args, **kwargs)¶
-
set(*args, **kwargs)¶
-
union(*args, **kwargs)¶
-
union_all(*args, **kwargs)¶
-
update(*args, **kwargs)¶
-
where(*args, **kwargs)¶
-
with_(*args, **kwargs)¶
-
with_totals(*args, **kwargs)¶
-
-
class
pypika.queries.Table(name, schema=None, alias=None)[source]¶ Bases:
pypika.queries.Selectable-
insert(*terms)[source]¶ Perform an INSERT operation on the current table
Parameters: terms – Type: list[expression]
A list of terms to select. These can be any type of int, float, str, bool or any other valid data
Returns: QueryBuilder
-