def insert_sqlite_hook():
    sqlite_hook = SqliteHook()

    rows = [('James', '11'), ('James', '22'), ('James', '33')]
    target_fields = ['first_name', 'last_name']
    sqlite_hook.insert_rows(table='Customers',
                            rows=rows,
                            target_fields=target_fields)
Beispiel #2
0
def replace_sqlite_hook():
    sqlite_hook = SqliteHook("sqlite_default")

    rows = [('James', '11'), ('James', '22'), ('James', '33')]
    target_fields = ['first_name', 'last_name']
    sqlite_hook.insert_rows(table='Customers',
                            rows=rows,
                            target_fields=target_fields,
                            replace=True)