@@ -3087,8 +3087,6 @@ The key functions are:
30873087:func: `~pandas.io.sql.read_table `
30883088
30893089
3090-
3091-
30923090In the following example, we use the `SQlite <http://www.sqlite.org/ >`__ SQL database
30933091engine. You can use a temporary SQLite database where data are stored in
30943092"memory".
@@ -3144,20 +3142,47 @@ the database using :func:`~pandas.io.sql.to_sql`.
31443142
31453143 sql.to_sql(data, ' data' , engine)
31463144
3147- You can read from the database simply by
3148- specifying a table name using the :func: `~pandas.io.sql.read_table ` function.
3145+ You can read from the database simply by specifying a table
3146+ name using the :func: `~pandas.io.sql.read_table ` function.
3147+
3148+ .. note ::
3149+
3150+ In order to use read_table, you MUST have the SQLAlchemy optional
3151+ dependency installed.
31493152
31503153.. ipython :: python
31513154
31523155 sql.read_table(' data' , engine)
31533156
3154- You can also specify the name of the column as the DataFrame index:
3157+ You can also specify the name of the column as the DataFrame index,
3158+ and specify a subset of columns to be read.
31553159
31563160.. ipython :: python
31573161
31583162 sql.read_table(' data' , engine, index_col = ' id' )
3163+ sql.read_table(' data' , engine, columns = [' Col_1' , ' Col_2' ])
3164+
3165+ And you can explicitly force columns to be parsed as dates:
3166+
3167+ .. ipython :: python
3168+
3169+ sql.read_table(' data' , engine, parse_dates = [' Date' ])
3170+
3171+ If needed you can explicitly specifiy a format string, or a dict of arguments
3172+ to pass to :func: `pandas.tseries.tools.to_datetime `.
3173+
3174+ .. code-block :: python
3175+
3176+ sql.read_table(' data' , engine, parse_dates = {' Date' : ' %Y-%m-%d ' })
3177+ sql.read_table(' data' , engine, parse_dates = {' Date' : {' format' : ' %Y-%m-%d %H:%M:%S' }})
3178+
3179+ Querying
3180+ ~~~~~~~~
31593181
31603182You can also query using raw SQL in the :func: `~pandas.io.sql.read_sql ` function.
3183+ In this case you must use valid SQL for your database.
3184+ When using SQLAlchemy, you can also pass SQLAlchemy Expression language constructs,
3185+ which are database-agnostic.
31613186
31623187.. ipython :: python
31633188
@@ -3174,10 +3199,13 @@ There are a few other available functions:
31743199
31753200:func: `~pandas.io.sql.has_table ` checks if a given table exists.
31763201
3202+ <<<<<<< HEAD
31773203:func: `~pandas.io.sql.tquery ` returns a list of tuples corresponding to each row.
31783204
31793205:func: `~pandas.io.sql.uquery ` does the same thing as tquery, but instead of
31803206returning results it returns the number of related rows.
3207+ =======
3208+ >>>>>>> ac6bf42... ENH #4163 Added more robust type coertion, datetime parsing, and parse date options. Updated optional dependancies
31813209
31823210In addition, the class :class: `~pandas.io.sql.PandasSQLWithEngine ` can be
31833211instantiated directly for more manual control over the SQL interaction.
0 commit comments