Expand description
An abstract syntax tree for SQL queries.
The ast module handles everything related building abstract SQL queries without going into database-level specifics.
Structs§
- Aggregate
ToString - An aggregate function that concatenates strings from a group into a single string with various options.
- Average
- A representation of the
AVGfunction in the database. - Coalesce
- Returns the first non-null expression
- Column
- A column definition.
- Common
Table Expression - Concat
- A representation of the
Concatfunction in the database. - Count
- Returns the number of rows that matches a specified criteria.
- Delete
- A builder for a
DELETEstatement. - Encode
- A representation of the
encodefunction in PostgreSQL. - Expression
- An expression that can be positioned in a query. Can be a single value or a statement that is evaluated into a value.
- Function
- A database function definition
- Grouping
- A list of definitions for the
GROUP BYstatement - Insert
- A builder for an
INSERTstatement. - Join
Data - The
JOINtable and conditions. - JsonAgg
- A representation of the
json_aggfunction in PostgreSQL. - Json
Build Object - Json
Extract - Json
Unquote - Lower
- A represention of the
LOWERfunction in the database. - Map
- Represents a JSON key/value type.
- Maximum
- A represention of the
MAXfunction in the database. - Minimum
- A represention of the
MINfunction in the database. - Multi
RowInsert - A builder for an
INSERTstatement for multiple rows. - Ordering
- A list of definitions for the
ORDER BYstatement. - Over
- Determines the partitioning and ordering of a rowset before the associated window function is applied.
- Row
- A collection of values surrounded by parentheses.
- RowNumber
- A window function that assigns a sequential integer number to each row in the query’s result set.
- RowTo
Json - A representation of the
ROW_TO_JSONfunction in the database. Only forPostgresql - Select
- A builder for a
SELECTstatement. - Single
RowInsert - A builder for an
INSERTstatement for a single row. - Sum
- A represention of the
SUMfunction in the database. - Table
- A table definition
- ToJsonb
- A representation of the
to_jsonbfunction in PostgreSQL. - Update
- A builder for an
UPDATEstatement. - Upper
- A represention of the
UPPERfunction in the database. - Values
- An in-memory temporary table. Can be used in some of the databases in a place of an actual table. Doesn’t work in MySQL 5.7.
Enums§
- Compare
- For modeling comparison expressions.
- Condition
Tree - Tree structures and leaves for condition building.
- Encode
Format - The encode format.
- Expression
Kind - An expression we can compare and use in database queries.
- Join
- A representation of a
JOINstatement. - Json
Compare - Json
Path - Json
Type - OnConflict
INSERTconflict resolution strategies.- Order
- The ordering direction
- Query
- A database query
- SqlOp
- Calculation operations in SQL queries.
- Table
Type - Either an identifier or a nested query.
- Type
Data Length - Value
- Represents any valid JSON value.
Traits§
- Aliasable
- An object that can be aliased.
- Comparable
- An item that can be compared against other values in the database.
- Conjunctive
AND,ORandNOTconjunctive implementations.- Groupable
- An item that can be used in the
GROUP BYstatement - Into
Group ByDefinition - Convert the value into a group by definition.
- Into
Order Definition - Convert the value into an order definition with order item and direction
- Joinable
- An item that can be joined.
- Orderable
- An item that can be used in the
ORDER BYstatement
Functions§
- aggregate_
to_ string - Aggregates the given field into a string.
- asterisk
- A quick alias to create an asterisk to a table.
- avg
- Calculates the average value of a numeric column.
- coalesce
- Returns the first non-null argument
- concat
- Concat several expressions.
- count
- Count of the underlying table where the given expression is not null.
- default_
value - A quick alias to create a default value expression.
- encode
- Return the given table as JSONB collection.
- json_
agg - Return the given table as JSONB collection.
- json_
build_ object - json_
extract - Extracts a subset of a JSON blob given a path. Two types of paths can be used:
- json_
unquote - Converts a JSON expression into string and unquotes it.
- lower
- Converts the result of the expression into lowercase string.
- max
- Calculates the maximum value of a numeric column.
- min
- Calculates the minimum value of a numeric column.
- raw
- A quick alias to create a raw value expression.
- row_
number - A number from 1 to n in specified order
- row_
to_ json - Return the given table in
JSONformat. - sum
- Calculates the sum value of a numeric column.
- to_
jsonb - Return the given table in JSONB.
- upper
- Converts the result of the expression into uppercase string.
Type Aliases§
- Group
ByDefinition - Defines a grouping for the
GROUP BYstatement. - Order
Definition - Defines ordering for an
ORDER BYstatement.