types - columns data types¶
- class CITEXT[source]¶
Postgres case-insensitive text data type.
- __init__(length: int | None = None, collation: str | None = None)¶
Create a string-holding type.
- Parameters:
length – optional, a length for the column for use in DDL and CAST expressions. May be safely omitted if no
CREATE TABLEwill be issued. Certain databases may require alengthfor use in DDL, and will raise an exception when theCREATE TABLEDDL is issued if aVARCHARwith no length is included. Whether the value is interpreted as bytes or characters is database specific.collation –
Optional, a column-level collation for use in DDL and CAST expressions. Renders using the COLLATE keyword supported by SQLite, MySQL, and PostgreSQL. E.g.:
>>> from sqlalchemy import cast, select, String >>> print(select(cast('some string', String(collation='utf8')))) {printsql}SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1Note
In most cases, the
UnicodeorUnicodeTextdatatypes should be used for a_schema.Columnthat expects to store non-ascii data. These datatypes will ensure that the correct types are used on the database.
- class MigrationState[source]¶
Migration service migration.
This data format is used by migration services to perform migrations. See an example below.
{ "id": 0, "comments": "dev comments", "commands": [ "ALTER TABLE my_table ADD COLUMN new_col DEFAULT NULL;", "ALTER TABLE my_table DROP COLUMN old_col;", ] }
- id: int¶
state id, sequential integer >= 0
- comments: str¶
human readable comments
- commands: list[str]¶
a list of sql commands performed inside a transaction block