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
AVG
function in the database. - Coalesce
- Returns the first non-null expression
- Column
- A column definition.
- Common
Table Expression - Concat
- A representation of the
Concat
function in the database. - Count
- Returns the number of rows that matches a specified criteria.
- Delete
- A builder for a
DELETE
statement. - Encode
- A representation of the
encode
function 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 BY
statement - Insert
- A builder for an
INSERT
statement. - Join
Data - The
JOIN
table and conditions. - JsonAgg
- A representation of the
json_agg
function in PostgreSQL. - Json
Build Object - Json
Extract - Json
Unquote - Lower
- A represention of the
LOWER
function in the database. - Map
- Represents a JSON key/value type.
- Maximum
- A represention of the
MAX
function in the database. - Minimum
- A represention of the
MIN
function in the database. - Multi
RowInsert - A builder for an
INSERT
statement for multiple rows. - Ordering
- A list of definitions for the
ORDER BY
statement. - 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_JSON
function in the database. Only forPostgresql
- Select
- A builder for a
SELECT
statement. - Single
RowInsert - A builder for an
INSERT
statement for a single row. - Sum
- A represention of the
SUM
function in the database. - Table
- A table definition
- ToJsonb
- A representation of the
to_jsonb
function in PostgreSQL. - Update
- A builder for an
UPDATE
statement. - Upper
- A represention of the
UPPER
function 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
JOIN
statement. - Json
Compare - Json
Path - Json
Type - OnConflict
INSERT
conflict 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
,OR
andNOT
conjunctive implementations.- Groupable
- An item that can be used in the
GROUP BY
statement - 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 BY
statement
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
JSON
format. - 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 BY
statement. - Order
Definition - Defines ordering for an
ORDER BY
statement.