def to_sql(self, name, con, schema=None, if_exists='fail', index=True, index_label=None, chunksize=None, dtype=None, method=None):
    '\n        Write records stored in a DataFrame to a SQL database.\n\n        Databases supported by SQLAlchemy [1]_ are supported. Tables can be\n        newly created, appended to, or overwritten.\n\n        Parameters\n        ----------\n        name : string\n            Name of SQL table.\n        con : sqlalchemy.engine.Engine or sqlite3.Connection\n            Using SQLAlchemy makes it possible to use any DB supported by that\n            library. Legacy support is provided for sqlite3.Connection objects.\n        schema : string, optional\n            Specify the schema (if database flavor supports this). If None, use\n            default schema.\n        if_exists : {\'fail\', \'replace\', \'append\'}, default \'fail\'\n            How to behave if the table already exists.\n\n            * fail: Raise a ValueError.\n            * replace: Drop the table before inserting new values.\n            * append: Insert new values to the existing table.\n\n        index : bool, default True\n            Write DataFrame index as a column. Uses `index_label` as the column\n            name in the table.\n        index_label : string or sequence, default None\n            Column label for index column(s). If None is given (default) and\n            `index` is True, then the index names are used.\n            A sequence should be given if the DataFrame uses MultiIndex.\n        chunksize : int, optional\n            Rows will be written in batches of this size at a time. By default,\n            all rows will be written at once.\n        dtype : dict, optional\n            Specifying the datatype for columns. The keys should be the column\n            names and the values should be the SQLAlchemy types or strings for\n            the sqlite3 legacy mode.\n        method : {None, \'multi\', callable}, default None\n            Controls the SQL insertion clause used:\n\n            * None : Uses standard SQL ``INSERT`` clause (one per row).\n            * \'multi\': Pass multiple values in a single ``INSERT`` clause.\n            * callable with signature ``(pd_table, conn, keys, data_iter)``.\n\n            Details and a sample callable implementation can be found in the\n            section :ref:`insert method <io.sql.method>`.\n\n            .. versionadded:: 0.24.0\n\n        Raises\n        ------\n        ValueError\n            When the table already exists and `if_exists` is \'fail\' (the\n            default).\n\n        See Also\n        --------\n        read_sql : Read a DataFrame from a table.\n\n        Notes\n        -----\n        Timezone aware datetime columns will be written as\n        ``Timestamp with timezone`` type with SQLAlchemy if supported by the\n        database. Otherwise, the datetimes will be stored as timezone unaware\n        timestamps local to the original timezone.\n\n        .. versionadded:: 0.24.0\n\n        References\n        ----------\n        .. [1] http://docs.sqlalchemy.org\n        .. [2] https://www.python.org/dev/peps/pep-0249/\n\n        Examples\n        --------\n\n        Create an in-memory SQLite database.\n\n        >>> from sqlalchemy import create_engine\n        >>> engine = create_engine(\'sqlite://\', echo=False)\n\n        Create a table from scratch with 3 rows.\n\n        >>> df = pd.DataFrame({\'name\' : [\'User 1\', \'User 2\', \'User 3\']})\n        >>> df\n             name\n        0  User 1\n        1  User 2\n        2  User 3\n\n        >>> df.to_sql(\'users\', con=engine)\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 1\'), (1, \'User 2\'), (2, \'User 3\')]\n\n        >>> df1 = pd.DataFrame({\'name\' : [\'User 4\', \'User 5\']})\n        >>> df1.to_sql(\'users\', con=engine, if_exists=\'append\')\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 1\'), (1, \'User 2\'), (2, \'User 3\'),\n         (0, \'User 4\'), (1, \'User 5\')]\n\n        Overwrite the table with just ``df1``.\n\n        >>> df1.to_sql(\'users\', con=engine, if_exists=\'replace\',\n        ...            index_label=\'id\')\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 4\'), (1, \'User 5\')]\n\n        Specify the dtype (especially useful for integers with missing values).\n        Notice that while pandas is forced to store the data as floating point,\n        the database supports nullable integers. When fetching the data with\n        Python, we get back integer scalars.\n\n        >>> df = pd.DataFrame({"A": [1, None, 2]})\n        >>> df\n             A\n        0  1.0\n        1  NaN\n        2  2.0\n\n        >>> from sqlalchemy.types import Integer\n        >>> df.to_sql(\'integers\', con=engine, index=False,\n        ...           dtype={"A": Integer()})\n\n        >>> engine.execute("SELECT * FROM integers").fetchall()\n        [(1,), (None,), (2,)]\n        '
    from pandas.io import sql
    sql.to_sql(self, name, con, schema=schema, if_exists=if_exists, index=index, index_label=index_label, chunksize=chunksize, dtype=dtype, method=method)
Write records stored in a DataFrame to a SQL database.

Databases supported by SQLAlchemy [1]_ are supported. Tables can be
newly created, appended to, or overwritten.

Parameters
----------
name : string
    Name of SQL table.
con : sqlalchemy.engine.Engine or sqlite3.Connection
    Using SQLAlchemy makes it possible to use any DB supported by that
    library. Legacy support is provided for sqlite3.Connection objects.
schema : string, optional
    Specify the schema (if database flavor supports this). If None, use
    default schema.
if_exists : {'fail', 'replace', 'append'}, default 'fail'
    How to behave if the table already exists.

    * fail: Raise a ValueError.
    * replace: Drop the table before inserting new values.
    * append: Insert new values to the existing table.

index : bool, default True
    Write DataFrame index as a column. Uses `index_label` as the column
    name in the table.
index_label : string or sequence, default None
    Column label for index column(s). If None is given (default) and
    `index` is True, then the index names are used.
    A sequence should be given if the DataFrame uses MultiIndex.
chunksize : int, optional
    Rows will be written in batches of this size at a time. By default,
    all rows will be written at once.
dtype : dict, optional
    Specifying the datatype for columns. The keys should be the column
    names and the values should be the SQLAlchemy types or strings for
    the sqlite3 legacy mode.
method : {None, 'multi', callable}, default None
    Controls the SQL insertion clause used:

    * None : Uses standard SQL ``INSERT`` clause (one per row).
    * 'multi': Pass multiple values in a single ``INSERT`` clause.
    * callable with signature ``(pd_table, conn, keys, data_iter)``.

    Details and a sample callable implementation can be found in the
    section :ref:`insert method <io.sql.method>`.

    .. versionadded:: 0.24.0

Raises
------
ValueError
    When the table already exists and `if_exists` is 'fail' (the
    default).

See Also
--------
read_sql : Read a DataFrame from a table.

Notes
-----
Timezone aware datetime columns will be written as
``Timestamp with timezone`` type with SQLAlchemy if supported by the
database. Otherwise, the datetimes will be stored as timezone unaware
timestamps local to the original timezone.

.. versionadded:: 0.24.0

References
----------
.. [1] http://docs.sqlalchemy.org
.. [2] https://www.python.org/dev/peps/pep-0249/

Examples
--------

Create an in-memory SQLite database.

>>> from sqlalchemy import create_engine
>>> engine = create_engine('sqlite://', echo=False)

Create a table from scratch with 3 rows.

>>> df = pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3']})
>>> df
     name
0  User 1
1  User 2
2  User 3

>>> df.to_sql('users', con=engine)
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 1'), (1, 'User 2'), (2, 'User 3')]

>>> df1 = pd.DataFrame({'name' : ['User 4', 'User 5']})
>>> df1.to_sql('users', con=engine, if_exists='append')
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 1'), (1, 'User 2'), (2, 'User 3'),
 (0, 'User 4'), (1, 'User 5')]

Overwrite the table with just ``df1``.

>>> df1.to_sql('users', con=engine, if_exists='replace',
...            index_label='id')
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 4'), (1, 'User 5')]

Specify the dtype (especially useful for integers with missing values).
Notice that while pandas is forced to store the data as floating point,
the database supports nullable integers. When fetching the data with
Python, we get back integer scalars.

>>> df = pd.DataFrame({"A": [1, None, 2]})
>>> df
     A
0  1.0
1  NaN
2  2.0

>>> from sqlalchemy.types import Integer
>>> df.to_sql('integers', con=engine, index=False,
...           dtype={"A": Integer()})

>>> engine.execute("SELECT * FROM integers").fetchall()
[(1,), (None,), (2,)]
def to_sql(self, name, con, schema=None, if_exists='fail', index=True, index_label=None, chunksize=None, dtype=None, method=None):
    '\n        Write records stored in a DataFrame to a SQL database.\n\n        Databases supported by SQLAlchemy [1]_ are supported. Tables can be\n        newly created, appended to, or overwritten.\n\n        Parameters\n        ----------\n        name : string\n            Name of SQL table.\n        con : sqlalchemy.engine.Engine or sqlite3.Connection\n            Using SQLAlchemy makes it possible to use any DB supported by that\n            library. Legacy support is provided for sqlite3.Connection objects.\n        schema : string, optional\n            Specify the schema (if database flavor supports this). If None, use\n            default schema.\n        if_exists : {\'fail\', \'replace\', \'append\'}, default \'fail\'\n            How to behave if the table already exists.\n\n            * fail: Raise a ValueError.\n            * replace: Drop the table before inserting new values.\n            * append: Insert new values to the existing table.\n\n        index : bool, default True\n            Write DataFrame index as a column. Uses `index_label` as the column\n            name in the table.\n        index_label : string or sequence, default None\n            Column label for index column(s). If None is given (default) and\n            `index` is True, then the index names are used.\n            A sequence should be given if the DataFrame uses MultiIndex.\n        chunksize : int, optional\n            Rows will be written in batches of this size at a time. By default,\n            all rows will be written at once.\n        dtype : dict, optional\n            Specifying the datatype for columns. The keys should be the column\n            names and the values should be the SQLAlchemy types or strings for\n            the sqlite3 legacy mode.\n        method : {None, \'multi\', callable}, default None\n            Controls the SQL insertion clause used:\n\n            * None : Uses standard SQL ``INSERT`` clause (one per row).\n            * \'multi\': Pass multiple values in a single ``INSERT`` clause.\n            * callable with signature ``(pd_table, conn, keys, data_iter)``.\n\n            Details and a sample callable implementation can be found in the\n            section :ref:`insert method <io.sql.method>`.\n\n            .. versionadded:: 0.24.0\n\n        Raises\n        ------\n        ValueError\n            When the table already exists and `if_exists` is \'fail\' (the\n            default).\n\n        See Also\n        --------\n        read_sql : Read a DataFrame from a table.\n\n        Notes\n        -----\n        Timezone aware datetime columns will be written as\n        ``Timestamp with timezone`` type with SQLAlchemy if supported by the\n        database. Otherwise, the datetimes will be stored as timezone unaware\n        timestamps local to the original timezone.\n\n        .. versionadded:: 0.24.0\n\n        References\n        ----------\n        .. [1] http://docs.sqlalchemy.org\n        .. [2] https://www.python.org/dev/peps/pep-0249/\n\n        Examples\n        --------\n\n        Create an in-memory SQLite database.\n\n        >>> from sqlalchemy import create_engine\n        >>> engine = create_engine(\'sqlite://\', echo=False)\n\n        Create a table from scratch with 3 rows.\n\n        >>> df = pd.DataFrame({\'name\' : [\'User 1\', \'User 2\', \'User 3\']})\n        >>> df\n             name\n        0  User 1\n        1  User 2\n        2  User 3\n\n        >>> df.to_sql(\'users\', con=engine)\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 1\'), (1, \'User 2\'), (2, \'User 3\')]\n\n        >>> df1 = pd.DataFrame({\'name\' : [\'User 4\', \'User 5\']})\n        >>> df1.to_sql(\'users\', con=engine, if_exists=\'append\')\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 1\'), (1, \'User 2\'), (2, \'User 3\'),\n         (0, \'User 4\'), (1, \'User 5\')]\n\n        Overwrite the table with just ``df1``.\n\n        >>> df1.to_sql(\'users\', con=engine, if_exists=\'replace\',\n        ...            index_label=\'id\')\n        >>> engine.execute("SELECT * FROM users").fetchall()\n        [(0, \'User 4\'), (1, \'User 5\')]\n\n        Specify the dtype (especially useful for integers with missing values).\n        Notice that while pandas is forced to store the data as floating point,\n        the database supports nullable integers. When fetching the data with\n        Python, we get back integer scalars.\n\n        >>> df = pd.DataFrame({"A": [1, None, 2]})\n        >>> df\n             A\n        0  1.0\n        1  NaN\n        2  2.0\n\n        >>> from sqlalchemy.types import Integer\n        >>> df.to_sql(\'integers\', con=engine, index=False,\n        ...           dtype={"A": Integer()})\n\n        >>> engine.execute("SELECT * FROM integers").fetchall()\n        [(1,), (None,), (2,)]\n        '
    from pandas.io import sql
    sql.to_sql(self, name, con, schema=schema, if_exists=if_exists, index=index, index_label=index_label, chunksize=chunksize, dtype=dtype, method=method)