Crate polite

Crate polite 

Source
Expand description

§Polite: SQLite × Polars Integration

A Rust library that provides seamless integration between SQLite databases and Polars DataFrames using ConnectorX for efficient data transfer.

§Features

  • Fast data loading: Use ConnectorX to efficiently load SQLite query results into Polars DataFrames
  • Easy data writing: Save Polars DataFrames directly to SQLite tables
  • Type preservation: Automatic mapping between Polars and SQLite data types
  • Simple API: Minimal boilerplate for common database operations

§Quick Start

use polite::{connect_sqlite, to_dataframe, from_dataframe};
use polars::prelude::*;

// Open a SQLite connection
let conn = connect_sqlite(Some("data.db")).unwrap();

// Load data from SQLite into a DataFrame
let df = to_dataframe("data.db", "SELECT * FROM users").unwrap();

// Save a DataFrame to SQLite
from_dataframe(&conn, "new_table", &df).unwrap();

§Modules

  • dataframe - Functions for converting between DataFrames and SQLite
  • db - Database connection utilities
  • error - Custom error types

Re-exports§

pub use dataframe::from_dataframe;
pub use dataframe::to_dataframe;
pub use db::connect_sqlite;
pub use db::execute_query;
pub use error::PoliteError;

Modules§

dataframe
db
error
prelude
Common imports for polite users.

Macros§

impl_transport
A macro to help define a Transport.
impl_typesystem
Associate physical representations to a typesystem.

Functions§

load_dataframe
Create a DataFrame from a SQLite file with error handling and logging.
save_dataframe
Save a DataFrame to SQLite with automatic table creation and better error handling.