pub fn insert_statement_from_schema(schema: &Schema, table_name: &str) -> String
Expand description

Creates an SQL insert statement from an arrow schema. The resulting statement will have one placeholer (?) for each column in the statement.

Note:

If table or column names are derived from user input, be sure to sanatize the input in order to prevent SQL injection attacks.

Example

use arrow_odbc::{
    insert_statement_from_schema,
    arrow::datatypes::{Field, DataType, Schema},
};

let field_a = Field::new("a", DataType::Int64, false);
let field_b = Field::new("b", DataType::Boolean, false);

let schema = Schema::new(vec![field_a, field_b]);
let sql = insert_statement_from_schema(&schema, "MyTable");

assert_eq!("INSERT INTO MyTable (a, b) VALUES (?, ?);", sql)

This function is automatically invoked by crate::OdbcWriter::with_connection.