asyncpg_simpleorm.column package¶
Submodules¶
asyncpg_simpleorm.column.column_types module¶
-
class
asyncpg_simpleorm.column.column_types.Array(_type, n=None, dimensions=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
ARRAYtype.Parameters: - _type – The type of the elements in the array. This would be another
ColumnTypesubclass. - n – An optional
int, that will make asizedarray. - dimensions – An optional
intthat will create a dimensional array.
Example:
>>> Array(Integer()).pg_type_string integer ARRAY >>> Array(Integer(), 3).pg_type_string integer ARRAY[3] >>> Array(Integer(), 3, 3).pg_type_string integer [3][3][3]
- _type – The type of the elements in the array. This would be another
-
class
asyncpg_simpleorm.column.column_types.BigInteger(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int8type.
-
class
asyncpg_simpleorm.column.column_types.BigSerial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial8type.
-
class
asyncpg_simpleorm.column.column_types.Binary(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
byteatype.
-
class
asyncpg_simpleorm.column.column_types.Bit(n, fixed_length=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
bitorvarbittype.Parameters: - n – The number of bits.
- fixed_length – An optional boolean. If
Truewe will usebit(n). IfFalse(default), we will usevarbit(n).
-
class
asyncpg_simpleorm.column.column_types.Boolean(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
booltype.
-
class
asyncpg_simpleorm.column.column_types.Box(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
boxtype.
-
class
asyncpg_simpleorm.column.column_types.Circle(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
circletype.
-
class
asyncpg_simpleorm.column.column_types.Date(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
datetype.
-
class
asyncpg_simpleorm.column.column_types.DateRange(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
daterangetype.
-
class
asyncpg_simpleorm.column.column_types.Double(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
float8type.
-
class
asyncpg_simpleorm.column.column_types.FixedLengthString(n)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
chartype.Parameters: n ( int) – The number of characters.
-
class
asyncpg_simpleorm.column.column_types.IPAddress(inet=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
cidrorinettypes.Parameters: inet – An optional bool. If Truethen we will useinet. IfFalse(default) then we usecidr.
-
class
asyncpg_simpleorm.column.column_types.Integer(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
integertype.
-
class
asyncpg_simpleorm.column.column_types.IntegerRange(big=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int4rangeorint8rangetypes.Parameters: big – A boolean if Truethen will represent anint8range. IfFalse(default) then we will useint4range.
-
class
asyncpg_simpleorm.column.column_types.Json(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
jsontype.
-
class
asyncpg_simpleorm.column.column_types.JsonB(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
jsonbtype.This is not supported by all postgres versions.
-
class
asyncpg_simpleorm.column.column_types.Line(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
linetype.
-
class
asyncpg_simpleorm.column.column_types.LineSegment(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
lsegtype.
-
class
asyncpg_simpleorm.column.column_types.MACAddress(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
macaddrtype.
-
class
asyncpg_simpleorm.column.column_types.Money(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
moneytype.
-
class
asyncpg_simpleorm.column.column_types.Number(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
numerictype.
-
class
asyncpg_simpleorm.column.column_types.NumericRange(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
numrangetype.
-
class
asyncpg_simpleorm.column.column_types.PGLogSequenceNumber(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pg_lsntype.This is not supported by all postgres versions.
-
class
asyncpg_simpleorm.column.column_types.Path(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pathtype.
-
class
asyncpg_simpleorm.column.column_types.Point(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pointtype.
-
class
asyncpg_simpleorm.column.column_types.Polygon(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
polygontype.
-
class
asyncpg_simpleorm.column.column_types.Real(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
float4type.
-
class
asyncpg_simpleorm.column.column_types.Serial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial4type.
-
class
asyncpg_simpleorm.column.column_types.SmallInteger(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int2type.
-
class
asyncpg_simpleorm.column.column_types.SmallSerial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial2type.
-
class
asyncpg_simpleorm.column.column_types.String(n=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres string column. Dependening on the context this will either produce a
textcolumn orvarchar(n)column.Parameters: n ( Optional[int]) – An optional integer for the length of the string. If this is present then we usevarchar(n), else we usetext.
-
class
asyncpg_simpleorm.column.column_types.TextSearchQuery(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
tsquerytype.
-
class
asyncpg_simpleorm.column.column_types.TextSearchVector(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
tsvectortype.
-
class
asyncpg_simpleorm.column.column_types.Time(with_timezone=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
timeortimetztype.Parameters: with_timezone ( bool) – IfTruethen it is time with timezone. IfFalse(default) then it time without timezone.
-
class
asyncpg_simpleorm.column.column_types.TimeInterval(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
intervaltype.
-
class
asyncpg_simpleorm.column.column_types.Timestamp(with_timezone=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
timestamportimestamptztype.Parameters: with_timezone ( bool) – IfTruethen it is timestamp with timezone type. IfFalse(default) then it timestamp without timezone type.
-
class
asyncpg_simpleorm.column.column_types.TransactionID(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
txid_snapshottype.
Module contents¶
-
class
asyncpg_simpleorm.column.Column(key=None, _type=None, *, default=None, primary_key=False)[source]¶ Bases:
objectA descriptor class that represents a table column.
Parameters: - key (
Optional[str]) – The table column name in the database. If not set, then this will be set to the attribute name used on theAsyncModelsubclass the column was declared on. - type – The
ColumnTypesubclass to use for the column. - default (
Optional[Any]) – A value or callable that is used for a default value. If this is callable, then it should recieve no input and return a value when called. - primary_key (
bool) – Set’s if the column is a primary key column. Primary key columns are used in certain query statements, such asAsyncModel.save()
-
default¶
-
key¶
-
pg_column_string¶ Return type: str
-
primary_key¶
- key (
-
class
asyncpg_simpleorm.column.ColumnTypeABC(*args, **kwargs)[source]¶ Bases:
objectAbstract representation of a postgres column type.
-
pg_type_string¶ Return the postgres type string.
Return type: str
-
-
class
asyncpg_simpleorm.column.ColumnTypeMeta(*args, **kwargs)[source]¶ Bases:
typeEnsures all ColumnType’s declare
__slots__. If a subclass does not have an__init__method, then this metaclass will add the__slots__attribute.Raises: RuntimeError – If subclass has an __init__method and does not declare__slots__.
-
class
asyncpg_simpleorm.column.ColumnType(string=None)[source]¶ Bases:
objectImplementation of
ColumnTypeABC.This can be used as a generic column type, by passing a string into the constructor. That string will be used, else we will use a value that’s passed into the class declaration at
pg_type_string.Parameters: string ( Optional[str]) – An optional input string that will be used for the column type. This string is not checked or validated, so if it’s not valid errors will bubble up when trying to create the table.Examples:
>>> str(ColumnType('text')) 'text' >>> class Text(ColumnType, pg_type_string='text'): pass >>> str(Text()) 'text'
Custom subclasses should implement
__slots__. If they don’t need to set any attributes on the class (which is typically the case) and they derive fromColumnTypethen the__slots__will be automatically added to the subclass.-
pg_type_string¶ Return’s the postgres column type string for an instance.
Raises: TypeError – If neither an input string was passed in or pg_type_stringin the class declaration.Return type: str
-
-
class
asyncpg_simpleorm.column.String(n=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres string column. Dependening on the context this will either produce a
textcolumn orvarchar(n)column.Parameters: n ( Optional[int]) – An optional integer for the length of the string. If this is present then we usevarchar(n), else we usetext.
-
class
asyncpg_simpleorm.column.UUID(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
uuidtype.
-
class
asyncpg_simpleorm.column.Boolean(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
booltype.
-
class
asyncpg_simpleorm.column.Integer(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
integertype.
-
class
asyncpg_simpleorm.column.Number(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
numerictype.
-
class
asyncpg_simpleorm.column.Date(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
datetype.
-
class
asyncpg_simpleorm.column.Time(with_timezone=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
timeortimetztype.Parameters: with_timezone ( bool) – IfTruethen it is time with timezone. IfFalse(default) then it time without timezone.
-
class
asyncpg_simpleorm.column.Timestamp(with_timezone=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
timestamportimestamptztype.Parameters: with_timezone ( bool) – IfTruethen it is timestamp with timezone type. IfFalse(default) then it timestamp without timezone type.
-
class
asyncpg_simpleorm.column.TimeInterval(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
intervaltype.
-
class
asyncpg_simpleorm.column.Bit(n, fixed_length=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
bitorvarbittype.Parameters: - n – The number of bits.
- fixed_length – An optional boolean. If
Truewe will usebit(n). IfFalse(default), we will usevarbit(n).
-
class
asyncpg_simpleorm.column.BigInteger(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int8type.
-
class
asyncpg_simpleorm.column.Array(_type, n=None, dimensions=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
ARRAYtype.Parameters: - _type – The type of the elements in the array. This would be another
ColumnTypesubclass. - n – An optional
int, that will make asizedarray. - dimensions – An optional
intthat will create a dimensional array.
Example:
>>> Array(Integer()).pg_type_string integer ARRAY >>> Array(Integer(), 3).pg_type_string integer ARRAY[3] >>> Array(Integer(), 3, 3).pg_type_string integer [3][3][3]
- _type – The type of the elements in the array. This would be another
-
class
asyncpg_simpleorm.column.BigSerial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial8type.
-
class
asyncpg_simpleorm.column.Binary(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
byteatype.
-
class
asyncpg_simpleorm.column.FixedLengthString(n)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
chartype.Parameters: n ( int) – The number of characters.
-
class
asyncpg_simpleorm.column.Money(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
moneytype.
-
class
asyncpg_simpleorm.column.IPAddress(inet=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
cidrorinettypes.Parameters: inet – An optional bool. If Truethen we will useinet. IfFalse(default) then we usecidr.
-
class
asyncpg_simpleorm.column.MACAddress(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
macaddrtype.
-
class
asyncpg_simpleorm.column.Box(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
boxtype.
-
class
asyncpg_simpleorm.column.Line(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
linetype.
-
class
asyncpg_simpleorm.column.LineSegment(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
lsegtype.
-
class
asyncpg_simpleorm.column.Circle(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
circletype.
-
class
asyncpg_simpleorm.column.Path(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pathtype.
-
class
asyncpg_simpleorm.column.Point(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pointtype.
-
class
asyncpg_simpleorm.column.Polygon(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
polygontype.
-
class
asyncpg_simpleorm.column.Double(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
float8type.
-
class
asyncpg_simpleorm.column.Json(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
jsontype.
-
class
asyncpg_simpleorm.column.JsonB(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
jsonbtype.This is not supported by all postgres versions.
-
class
asyncpg_simpleorm.column.PGLogSequenceNumber(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
pg_lsntype.This is not supported by all postgres versions.
-
class
asyncpg_simpleorm.column.Real(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
float4type.
-
class
asyncpg_simpleorm.column.SmallInteger(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int2type.
-
class
asyncpg_simpleorm.column.SmallSerial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial2type.
-
class
asyncpg_simpleorm.column.Serial(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
serial4type.
-
class
asyncpg_simpleorm.column.TextSearchQuery(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
tsquerytype.
-
class
asyncpg_simpleorm.column.TextSearchVector(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
tsvectortype.
-
class
asyncpg_simpleorm.column.TransactionID(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
txid_snapshottype.
-
class
asyncpg_simpleorm.column.XML(string=None)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
xmltype.
-
class
asyncpg_simpleorm.column.IntegerRange(big=False)[source]¶ Bases:
asyncpg_simpleorm.column.base_column_type.ColumnTypeRepresentation of postgres
int4rangeorint8rangetypes.Parameters: big – A boolean if Truethen will represent anint8range. IfFalse(default) then we will useint4range.