sqlite_database.column module

Column

class sqlite_database.column.BuilderColumn(_from_typelist: list[str] | None = None)[source]

Bases: object

Builder Column – Column Implementation using Builder Column

allow_null()[source]

Allow null

default(default_value: Any)[source]

Set default value

foreign(source: str) Self[source]

Set foreign reference

on_delete(action: Literal['null', 'cascade', 'no act', 'default', 'restrict'])[source]

Set on delete action

on_update(action: Literal['null', 'cascade', 'no act', 'default', 'restrict'])[source]

Set on update action

primary() Self[source]

Set primary

set_type(name: str) Callable[[str], Self][source]

Set type from name, this will be handled by class’ type checking. This is a setup function. You need to do .set_type(type_name)(name) to do similiar effect to .integer(name) as for example

to_column()[source]

Conver from BuilderColumn to Column

unique() Self[source]

Set unique

class sqlite_database.column.Column(name: str, type_: str, foreign: bool = False, foreign_ref: str | None = None, primary: bool = False, unique: bool = False, nullable: bool = True, default: Any = None, on_delete: Literal['null', 'cascade', 'no act', 'default', 'restrict'] = 'cascade', on_update: Literal['null', 'cascade', 'no act', 'default', 'restrict'] = 'cascade')[source]

Bases: object

tip: for foreign_ref, you can split with / to separate table and column name. e.g: user/id

property default

Default value

property foreign

Is foreign enabled?

property name

Column Name

property nullable

Nullable

property on_delete

Delete setting

property on_update

Update setting

property primary

Is primary or not?

property raw_source

Source / Foreign Reference

property source

Source / Foreign Reference

property source_column

Source column / Foreign reference column

property type

Type

property unique

Is unique

sqlite_database.column.blob(name: str) BuilderColumn[source]

Create a blob column with name

sqlite_database.column.integer(name: str) BuilderColumn[source]

Create a integer column with name

sqlite_database.column.real(name: str) BuilderColumn[source]

Create a real column with name

sqlite_database.column.text(name: str) BuilderColumn[source]

Create a text column with name