pub fn save_dataframe(
db_path: &str,
table_name: &str,
df: &DataFrame,
) -> Result<(), PoliteError>Expand description
Save a DataFrame to SQLite with automatic table creation and better error handling.
This convenience function handles connection creation and provides clearer error messages.
§Arguments
db_path- Path to the SQLite database file (will be created if it doesn’t exist)table_name- Name of the table to create/insert intodf- The DataFrame to save
§Examples
use polite::save_dataframe;
use polars::prelude::*;
let df = df! {
"id" => [1, 2, 3],
"name" => ["Alice", "Bob", "Charlie"],
}.unwrap();
save_dataframe("output.db", "users", &df)
.expect("Failed to save DataFrame");