neuralib.sqlp.stat.SqlInsertStat
- class neuralib.sqlp.stat.SqlInsertStat[source]
Bases:
SqlStat[T],SqlReturnStat,Generic[T]- __init__(table, fields=None, *, named=False)[source]
- Parameters:
table (type[T])
fields (list[str] | None)
named (bool)
Methods
__init__(table[, fields, named])add(stat)Add SQL token.
build()build a SQL statement.
defaults()insert default values
drop()on_conflict(*conflict[, where])returning(*expr)submit([parameter])build the SQL statement and execute.
values(*args, **kwargs)- __init__(table, fields=None, *, named=False)[source]
- Parameters:
table (type[T])
fields (list[str] | None)
named (bool)
- select_from(table: type[T], *, distinct: bool = False) SqlSelectStat[T][source]
- select_from(*field, distinct: bool = False, from_table: str | type | SqlAlias | SqlSelectStat = None) SqlSelectStat[tuple]
- on_conflict(*conflict, where=None)[source]
- Parameters:
where (bool | SqlCompareOper)
- Return type:
SqlUpsertStat[T]
- returning(*expr)[source]
- Parameters:
expr (str | SqlExpr)
- Return type:
SqlInsertStat[tuple]
- submit(parameter=())[source]
build the SQL statement and execute.
- Returns:
a cursor
- Raises:
RuntimeError – current statement does not bind with a connection.
- Parameters:
parameter (list[T])
- Return type:
Cursor[T]
- add(stat)
Add SQL token.
- Return type:
Self
- drop()