@@ -3160,7 +3160,8 @@ your database.
31603160.. versionadded :: 0.14.0
31613161
31623162If SQLAlchemy is not installed, a fallback is only provided for sqlite (and
3163- for mysql for backwards compatibility, but this is deprecated).
3163+ for mysql for backwards compatibility, but this is deprecated and will be
3164+ removed in a future version).
31643165This mode requires a Python database adapter which respect the `Python
31653166DB-API <http://www.python.org/dev/peps/pep-0249/> `__.
31663167
@@ -3190,14 +3191,12 @@ engine. You can use a temporary SQLite database where data are stored in
31903191To connect with SQLAlchemy you use the :func: `create_engine ` function to create an engine
31913192object from database URI. You only need to create the engine once per database you are
31923193connecting to.
3193-
31943194For more information on :func: `create_engine ` and the URI formatting, see the examples
31953195below and the SQLAlchemy `documentation <http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html >`__
31963196
31973197.. ipython :: python
31983198
31993199 from sqlalchemy import create_engine
3200- from pandas.io import sql
32013200 # Create your connection.
32023201 engine = create_engine(' sqlite:///:memory:' )
32033202
@@ -3280,8 +3279,6 @@ to pass to :func:`pandas.to_datetime`:
32803279
32813280 You can check if a table exists using :func: `~pandas.io.sql.has_table `
32823281
3283- In addition, the class :class: `~pandas.io.sql.PandasSQLWithEngine ` can be
3284- instantiated directly for more manual control over the SQL interaction.
32853282
32863283Querying
32873284~~~~~~~~
@@ -3310,18 +3307,18 @@ variant appropriate for your database.
33103307
33113308.. code-block :: python
33123309
3310+ from pandas.io import sql
33133311 sql.execute(' SELECT * FROM table_name' , engine)
3314-
33153312 sql.execute(' INSERT INTO table_name VALUES(?, ?, ?)' , engine, params = [(' id' , 1 , 12.2 , True )])
33163313
33173314
3318- In addition, the class :class: `~pandas.io.sql.PandasSQLWithEngine ` can be
3319- instantiated directly for more manual control over the SQL interaction.
3320-
3321-
33223315 Engine connection examples
33233316~~~~~~~~~~~~~~~~~~~~~~~~~~
33243317
3318+ To connect with SQLAlchemy you use the :func: `create_engine ` function to create an engine
3319+ object from database URI. You only need to create the engine once per database you are
3320+ connecting to.
3321+
33253322.. code-block :: python
33263323
33273324 from sqlalchemy import create_engine
@@ -3341,6 +3338,8 @@ Engine connection examples
33413338 # or absolute, starting with a slash:
33423339 engine = create_engine(' sqlite:////absolute/path/to/foo.db' )
33433340
3341+ For more information see the examples the SQLAlchemy `documentation <http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html >`__
3342+
33443343
33453344Sqlite fallback
33463345~~~~~~~~~~~~~~~
@@ -3354,16 +3353,14 @@ You can create connections like so:
33543353.. code-block :: python
33553354
33563355 import sqlite3
3357- from pandas.io import sql
3358- cnx = sqlite3.connect(' :memory:' )
3356+ con = sqlite3.connect(' :memory:' )
33593357
33603358 And then issue the following queries:
33613359
33623360.. code-block :: python
33633361
33643362 data.to_sql(' data' , cnx)
3365-
3366- sql.read_sql(" SELECT * FROM data" , cnx)
3363+ pd.read_sql_query(" SELECT * FROM data" , con)
33673364
33683365
33693366 .. _io.bigquery :
0 commit comments