Classes
AliasedColumn (…) |
Represents a column on an aliased table. |
Column |
Represents a column in a table in a database. |
asyncqlio.orm.schema.column.
AliasedColumn
(alias_table: asyncqlio.orm.schema.table.AliasedTable, column: asyncqlio.orm.schema.column.Column)[source]¶Bases: object
Represents a column on an aliased table.
Parameters: |
|
---|
asyncqlio.orm.schema.column.
Column
[source]¶Bases: object
Represents a column in a table in a database.
class MyTable(Table):
id = Column(Integer, primary_key=True)
The id
column will mirror the ID of records in the table when fetching, etc. and can be set
on a record when storing in a table.
sess = db.get_session()
user = await sess.select(User).where(User.id == 2).first()
print(user.id) # 2
Parameters: |
|
---|
name
= None¶The name of the column. This can be manually set, or automatically set when set on a table.
type
= None¶The ColumnType
that represents the type of this column.
default
= None¶The default for this column.
primary_key
= None¶If this Column is a primary key.
nullable
= None¶If this Column is nullable.
autoincrement
= None¶If this Column is to autoincrement.
indexed
= None¶If this Column is indexed.
unique
= None¶If this Column is unique.
foreign_key
= None¶The foreign key associated with this column.
eq
(other) → asyncqlio.orm.operators.Eq[source]¶Checks if this column is equal to something else.
Note
This is the easy way to check if a column equals another column in a WHERE clause, because the default __eq__ behaviour returns a bool rather than an operator.
ne
(other) → asyncqlio.orm.operators.NEq[source]¶Checks if this column is not equal to something else.
Note
This is the easy way to check if a column doesn’t equal another column in a WHERE clause, because the default __ne__ behaviour returns a bool rather than an operator.
asc
() → asyncqlio.orm.operators.AscSorter[source]¶Returns the ascending sorter operator for this column.
desc
() → asyncqlio.orm.operators.DescSorter[source]¶Returns the descending sorter operator for this column.
set
(value: typing.Any) → asyncqlio.orm.operators.ValueSetter[source]¶Sets this column in a bulk update.
incr
(value: typing.Any) → asyncqlio.orm.operators.IncrementSetter[source]¶Increments this column in a bulk update.
decr
(value: typing.Any) → asyncqlio.orm.operators.DecrementSetter[source]¶Decrements this column in a bulk update.
quoted_fullname_with_table
(table: asyncqlio.orm.schema.table.TableMeta) → str[source]¶Gets the quoted fullname with a table. This is used for columns with alias tables.
Parameters: | table – The Table or AliasedTable to use. |
---|---|
Returns: |
quoted_name
¶Gets the quoted name for this column.
This returns the column name in “column” format.
quoted_fullname
¶Gets the full quoted name for this column.
This returns the column name in “table”.”column” format.
alias_name
(table=None, quoted: bool = False) → str[source]¶Gets the alias name for a column, given the table.
This is in the format of t_<table name>_<column_name>.
Parameters: |
|
---|---|
Returns: | A str representing the alias name. |