neuralib.sqlp.table.Field

class neuralib.sqlp.table.Field[source]

Bases: NamedTuple

A SQL column, a field in a table.

table: type

associated table

name: str

column/field name

raw_type: type

origin field type

sql_type: type

column/field type. Should be supported by SQL

f_value: Any

default value.

not_null: bool

Is it not NULL.

annotated: list[Any]

Alias for field number 6

property table_name: str
property has_default: bool
property is_primary: bool
get_primary()[source]
Return type:

PRIMARY | None

property is_unique: bool
get_unique()[source]
Return type:

UNIQUE | None

get_annotation(annotation_type)[source]
Parameters:

annotation_type (type[T])

Return type:

T | None

static __new__(_cls, table, name, raw_type, sql_type, f_value=<object object>, not_null=True, annotated=())

Create new instance of Field(table, name, raw_type, sql_type, f_value, not_null, annotated)

Parameters:
  • table (type)

  • name (str)

  • raw_type (type)

  • sql_type (type)

  • f_value (Any)

  • not_null (bool)

  • annotated (list[Any])

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.