Skip to main content

duckdb_copy_function_set_copy_from_function

Function duckdb_copy_function_set_copy_from_function 

Source
pub unsafe extern "C" fn duckdb_copy_function_set_copy_from_function(
    copy_function: duckdb_copy_function,
    table_function: duckdb_table_function,
)
Expand description

Sets the table function to use when executing a COPY ... FROM (...) statement with this copy function.

The table function must have a duckdb_table_function_bind_t, duckdb_table_function_init_t and duckdb_table_function_t set.

The table function must take a single VARCHAR parameter (the file path).

Options passed to the COPY ... FROM (...) statement are forwarded as named parameters to the table function.

Since COPY ... FROM copies into an already existing table, the table function should not define its own result columns using duckdb_bind_add_result_column when binding . Instead use duckdb_table_function_bind_get_result_column_count and related functions in the bind callback of the table function to retrieve the schema of the target table of the COPY ... FROM statement.

@param copy_function The copy function @param table_function The table function to use for COPY ... FROM