neuralib.sqlp.table.ForeignConstraint

class neuralib.sqlp.table.ForeignConstraint[source]

Bases: NamedTuple

SQL foreign constraint.

__init__()

Methods

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Attributes

fields

associated fields

foreign_fields

referred foreign fields

foreign_table

referred foreign table

foreign_table_name

name

constraint name

on_delete

Alias for field number 6

on_update

Alias for field number 5

table

associated table

table_name

name: str

constraint name

table: type

associated table

fields: list[str]

associated fields

foreign_table: type

referred foreign table

foreign_fields: list[str]

referred foreign fields

on_update: Literal['SET NULL', 'SET DEFAULT', 'CASCADE', 'RESTRICT', 'NO ACTION']

Alias for field number 5

on_delete: Literal['SET NULL', 'SET DEFAULT', 'CASCADE', 'RESTRICT', 'NO ACTION']

Alias for field number 6

property table_name: str
static __new__(_cls, name, table, fields, foreign_table, foreign_fields, on_update, on_delete)

Create new instance of ForeignConstraint(name, table, fields, foreign_table, foreign_fields, on_update, on_delete)

Parameters:
  • name (str)

  • table (type)

  • fields (list[str])

  • foreign_table (type)

  • foreign_fields (list[str])

  • on_update (FOREIGN_POLICY)

  • on_delete (FOREIGN_POLICY)

count(value, /)

Return number of occurrences of value.

property foreign_table_name: str
index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.