pub fn insert_statement_from_schema(schema: &Schema, table_name: &str) -> StringExpand 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 the column name contains any character which would make it not a valid qualifier for transact
SQL it will be wrapped in double quotes (") within the insert schema. Valid names consist of
alpha numeric characters, @, $, # and _.
ยง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.