abraxos.load.to_sql¶
- abraxos.load.to_sql(df, name, con, *, if_exists='append', index=False, chunks=2, **kwargs)[source]
Writes a DataFrame to a SQL database table with error handling.
- Parameters:
df (pd.DataFrame) – The DataFrame to insert.
name (str) – Name of the target table.
con (SqlConnection or SqlEngine) – SQLAlchemy-like connection or engine object.
if_exists ({'fail', 'replace', 'append'}, optional) – SQL behavior if the table already exists (default is ‘append’).
index (bool, optional) – Whether to include the DataFrame index in the output (default is False).
chunks (int, optional) – Number of chunks to recursively split on failure (default is 2).
**kwargs (
typing.Any) – Additional arguments passed to pandas.DataFrame.to_sql.
- Returns:
A named tuple with lists of errors, failed rows, and successful rows.
- Return type:
ToSqlResult