ralsei.types.column

Module Contents

Classes

ColumnBase

Base class for Column and ColumnRendered

Column

Column template class

ColumnRendered

Rendered column class

ColumnDefinition

Renders to table_name TYPE, for use in table definitions

API

class ralsei.types.column.ColumnBase(name: str)

Bases: abc.ABC

Base class for Column and ColumnRendered

Initialization

name : str = None
property identifier : ralsei.types.primitives.Identifier

name wrapped in a SQL identifier

abstract render(env: ralsei.jinja.ISqlEnvironment, /, **params: Any) ralsei.types.column.ColumnRendered

Turn into the rendered version

class ralsei.types.column.Column(name: str, type: str)

Bases: ralsei.types.column.ColumnBase

Column template class

Parameters:
name: str

column name

type: str

jinja template of the column type, like INT REFERENCES {{other}}(id)

Initialization

render(env: ralsei.jinja.ISqlEnvironment, /, **params: Any) ralsei.types.column.ColumnRendered

Render the type template

class ralsei.types.column.ColumnRendered(name: str, type: str)

Bases: ralsei.types.column.ColumnBase

Rendered column class

Parameters:
name: str

column name

type: str

column type as raw sql string, like INT REFERENCES "other"(id)

Initialization

type : ralsei.types.primitives.Sql = None
property definition : ralsei.types.column.ColumnDefinition

As column definition (name + type)

render(env: ralsei.jinja.ISqlEnvironment, /, **params: Any) ralsei.types.column.ColumnRendered
class ralsei.types.column.ColumnDefinition(column: ralsei.types.column.ColumnRendered)

Bases: ralsei.types.to_sql.ToSql

Renders to table_name TYPE, for use in table definitions

Initialization

column : ralsei.types.column.ColumnRendered = None
to_sql(env: ralsei.jinja.ISqlEnvironment) str