Skip to main content

SqlReadOptions

Struct SqlReadOptions 

Source
pub struct SqlReadOptions {
    pub params: Option<Vec<Scalar>>,
    pub parse_dates: Option<Vec<String>>,
    pub coerce_float: bool,
    pub dtype: Option<BTreeMap<String, DType>>,
    pub schema: Option<String>,
    pub columns: Option<Vec<String>>,
    pub index_col: Option<String>,
}
Expand description

Options for reading SQL query results into a DataFrame.

Fields§

§params: Option<Vec<Scalar>>

Positional parameters to bind to ? placeholders in the SQL query.

§parse_dates: Option<Vec<String>>

Column names to coerce via pandas-style parse_dates handling. Currently supports explicit column-name selection.

§coerce_float: bool

Promote decimal-like SQL text result columns to Float64.

This is an opt-in form of pandas’ coerce_float behavior for backends that expose NUMERIC/DECIMAL/MONEY values through text. Columns containing any non-numeric strings are left unchanged.

§dtype: Option<BTreeMap<String, DType>>

Per-column dtype override applied after row materialization.

Matches pd.read_sql(.., dtype={'col': 'float64'}). Each entry casts the named column to the declared dtype using fp_types::cast_scalar_owned. Map entries for columns not present in the result are silently ignored (matches pandas). Columns also listed in parse_dates are skipped to avoid double-cast errors — parse_dates wins.

Per br-frankenpandas-l9pt (fd90.11).

§schema: Option<String>

Optional schema namespace for read_sql_table lookups.

Matches pd.read_sql_table(table, con, schema=...). When the backend reports supports_schemas() == true (PostgreSQL, MySQL, MSSQL, etc.) and schema is Some(s), the SELECT references s.table with each part quoted by conn.quote_identifier(...). When the backend reports supports_schemas() == false (SQLite), any Some(s) here is rejected before query execution. Pandas / SQLAlchemy raises NotImplementedError on that surface; failing closed avoids silently reading an unqualified table from the wrong namespace.

Per br-frankenpandas-u6zn (fd90.14).

§columns: Option<Vec<String>>

Optional projection list for read_sql_table reads.

Matches pd.read_sql_table(table, con, columns=[...]). When Some(list), the emitted SELECT projects only those columns (and in that order) instead of SELECT *. None preserves SELECT *. An empty Vec is rejected with IoError::Sql — pandas raises ValueError there. Each entry is validated via the standard alphanumeric+underscore policy.

Note: read_sql / read_sql_query ignore this field — it only takes effect on read_sql_table* paths, where frankenpandas builds the SELECT itself.

Per br-frankenpandas-d3e9 (fd90.34).

§index_col: Option<String>

Optional column name to promote to the DataFrame index.

Matches pd.read_sql(.., index_col=...) and pd.read_sql_table(table, con, index_col=...). When Some(name), after row materialization the named column is removed from the result and used as the DataFrame index. The column must exist in the read result (or in the projection when columns is also set). None preserves the default RangeIndex.

Empty string is rejected with IoError::Sql to match pandas’ ValueError. List-of-strings (for MultiIndex) is out of scope for this slice — single index only.

Per br-frankenpandas-c1h9 (fd90.36).

Trait Implementations§

Source§

impl Clone for SqlReadOptions

Source§

fn clone(&self) -> SqlReadOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SqlReadOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SqlReadOptions

Source§

fn default() -> Self

Per br-frankenpandas-o0x6 (fd90.41): pandas defaults coerce_float=True for read_sql / read_sql_query / read_sql_table so we follow suit. Other defaults are the natural empty / None values.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.