zut.Column
- class zut.Column(name: str, *, type: str | type | None = None, precision: int | None = None, scale: int | None = None, not_null: bool | None = None, primary_key: bool | None = None, identity: bool | None = None, default: Any | None = None, converter: Callable[[Any], Any] | Any | None = None)
Bases:
object
Column name with details, used in databases and CSV files.
- __init__(name: str, *, type: str | type | None = None, precision: int | None = None, scale: int | None = None, not_null: bool | None = None, primary_key: bool | None = None, identity: bool | None = None, default: Any | None = None, converter: Callable[[Any], Any] | Any | None = None)
Methods
__init__
(name, *[, type, precision, scale, ...])replace
(*[, name, type, precision, scale, ...])Attributes
The Python type of the column or the SQL type (a string, optionally including precision and scale).
Name of the column.
SQL precision specification for the SQL type (ignored if already in type)
SQL scale specification for the SQL type (ignored if already in type)
Indicate whether the column has a NOT NULL contraint.
Indicate whether the column is part of the primary key.
Indicate whether the column is an identity column.
Default value.
A converter callable, or a constant value.
- converter: Callable[[Any], Any] | Any | None
A converter callable, or a constant value.
- default: Any | None
Default value. Use now or now() for the current timestamp in the default timezone. Use sql:… to use direct sql.
- identity: bool | None
Indicate whether the column is an identity column.
- name: str
Name of the column.
- not_null: bool | None
Indicate whether the column has a NOT NULL contraint.
- precision: int | None
SQL precision specification for the SQL type (ignored if already in type)
- primary_key: bool | None
Indicate whether the column is part of the primary key.
- scale: int | None
SQL scale specification for the SQL type (ignored if already in type)
- property type: type | str | None
The Python type of the column or the SQL type (a string, optionally including precision and scale). Use Db.get_sql_type() or Db.get_python_type() functions to pass from one to the other.