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: boolPromote 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
impl Clone for SqlReadOptions
Source§fn clone(&self) -> SqlReadOptions
fn clone(&self) -> SqlReadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more