pandas 1.4.2

Parameters
to_sql(self, frame, name, if_exists='fail', index=True, index_label=None, schema=None, chunksize=None, dtype: 'DtypeArg | None' = None, method=None, **kwargs) -> 'int | None'

Parameters

frame: DataFrame :
name: string :

Name of SQL table.

if_exists: {'fail', 'replace', 'append'}, default 'fail' :

fail: If table exists, do nothing. replace: If table exists, drop it, recreate it, and insert data. append: If table exists, insert data. Create if it does not exist.

index : bool, default True

Write DataFrame index as a column

index_label : string or sequence, default None

Column label for index column(s). If None is given (default) and :None:None:`index` is True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.

schema : string, default None

Ignored parameter included for compatibility with SQLAlchemy version of to_sql .

chunksize : int, default None

If not None, then rows will be written in batches of this size at a time. If None, all rows will be written at once.

dtype : single type or dict of column name to SQL type, default None

Optional specifying the datatype for columns. The SQL type should be a string. If all columns are of the same type, one single value can be used.

method : {None, 'multi', callable}, default None

Controls the SQL insertion clause used:

Write records stored in a DataFrame to a SQL database.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/io/sql.py#2113
type: <class 'function'>
Commit: