neuralib.sqlp.stat_start.insert_into

neuralib.sqlp.stat_start.insert_into(table: type[T], *, policy: Literal['ABORT', 'FAIL', 'IGNORE', 'REPLACE', 'ROLLBACK'] = None, named=False) SqlInsertStat[T][source]
neuralib.sqlp.stat_start.insert_into(*field, policy: Literal['ABORT', 'FAIL', 'IGNORE', 'REPLACE', 'ROLLBACK'] = None, named=False) SqlInsertStat[T]

INSERT: https://www.sqlite.org/lang_insert.html

insert values

>>> insert_into(A, policy='REPLACE').build() 
INSERT OR REPLACE INTO A VALUES (?)
>>> insert_into(A, policy='REPLACE').submit([A(1), A(2)]) 

insert values with field overwrite

>>> insert_into(A, policy='REPLACE').values(a='1').build() 
INSERT OR REPLACE INTO A VALUES (1)

insert values from a table

>>> insert_into(A, policy='IGNORE').select_from(B).build() 
INSERT OR IGNORE INTO A
SELECT * FROM B

features supporting

  • INSERT [OR …]

  • VALUES

  • DEFAULT VALUES

  • SELECT

  • upsert clause

  • returning clause

features not supporting

  • WITH [RECURSIVE]

Parameters:
  • table

  • policy

  • named

Returns: