@@ -221,8 +221,8 @@ def uquery(sql, con=None, cur=None, retry=True, params=None):
221
221
#------------------------------------------------------------------------------
222
222
#--- Read and write to DataFrames
223
223
224
- def read_sql_table (table_name , con , meta = None , index_col = None ,
225
- coerce_float = True , parse_dates = None , columns = None ):
224
+ def read_sql_table (table_name , con , index_col = None , coerce_float = True ,
225
+ parse_dates = None , columns = None ):
226
226
"""Read SQL database table into a DataFrame.
227
227
228
228
Given a table name and an SQLAlchemy engine, returns a DataFrame.
@@ -234,8 +234,6 @@ def read_sql_table(table_name, con, meta=None, index_col=None,
234
234
Name of SQL table in database
235
235
con : SQLAlchemy engine
236
236
Sqlite DBAPI conncection mode not supported
237
- meta : SQLAlchemy meta, optional
238
- If omitted MetaData is reflected from engine
239
237
index_col : string, optional
240
238
Column to set as index
241
239
coerce_float : boolean, default True
@@ -264,7 +262,7 @@ def read_sql_table(table_name, con, meta=None, index_col=None,
264
262
265
263
266
264
"""
267
- pandas_sql = PandasSQLAlchemy (con , meta = meta )
265
+ pandas_sql = PandasSQLAlchemy (con )
268
266
table = pandas_sql .read_table (
269
267
table_name , index_col = index_col , coerce_float = coerce_float ,
270
268
parse_dates = parse_dates , columns = columns )
@@ -292,11 +290,10 @@ def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None,
292
290
library.
293
291
If a DBAPI2 object, only sqlite3 is supported.
294
292
index_col : string, optional
295
- column name to use for the returned DataFrame object.
293
+ Column name to use as index for the returned DataFrame object.
296
294
coerce_float : boolean, default True
297
295
Attempt to convert values to non-string, non-numeric objects (like
298
296
decimal.Decimal) to floating point, useful for SQL result sets
299
- cur : depreciated, cursor is obtained from connection
300
297
params : list, tuple or dict, optional
301
298
List of parameters to pass to execute method.
302
299
parse_dates : list or dict
@@ -325,8 +322,8 @@ def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None,
325
322
parse_dates = parse_dates )
326
323
327
324
328
- def read_sql (sql , con , index_col = None , flavor = 'sqlite' , coerce_float = True ,
329
- params = None , parse_dates = None , columns = None ):
325
+ def read_sql (sql , con , index_col = None , coerce_float = True , params = None ,
326
+ parse_dates = None , columns = None ):
330
327
"""
331
328
Read SQL query or database table into a DataFrame.
332
329
@@ -339,15 +336,10 @@ def read_sql(sql, con, index_col=None, flavor='sqlite', coerce_float=True,
339
336
library.
340
337
If a DBAPI2 object, only sqlite3 is supported.
341
338
index_col : string, optional
342
- column name to use for the returned DataFrame object.
343
- flavor : string, {'sqlite', 'mysql'}
344
- The flavor of SQL to use. Ignored when using
345
- SQLAlchemy engine. Required when using DBAPI2 connection.
346
- 'mysql' is still supported, but will be removed in future versions.
339
+ column name to use as index for the returned DataFrame object.
347
340
coerce_float : boolean, default True
348
341
Attempt to convert values to non-string, non-numeric objects (like
349
342
decimal.Decimal) to floating point, useful for SQL result sets
350
- cur : depreciated, cursor is obtained from connection
351
343
params : list, tuple or dict, optional
352
344
List of parameters to pass to execute method.
353
345
parse_dates : list or dict
@@ -360,7 +352,8 @@ def read_sql(sql, con, index_col=None, flavor='sqlite', coerce_float=True,
360
352
Especially useful with databases without native Datetime support,
361
353
such as SQLite
362
354
columns : list
363
- List of column names to select from sql table
355
+ List of column names to select from sql table (only used when reading
356
+ a table).
364
357
365
358
Returns
366
359
-------
@@ -379,7 +372,7 @@ def read_sql(sql, con, index_col=None, flavor='sqlite', coerce_float=True,
379
372
read_sql_query : Read SQL query into a DataFrame
380
373
381
374
"""
382
- pandas_sql = pandasSQL_builder (con , flavor = flavor )
375
+ pandas_sql = pandasSQL_builder (con )
383
376
384
377
if 'select' in sql .lower ():
385
378
try :
@@ -419,8 +412,8 @@ def to_sql(frame, name, con, flavor='sqlite', if_exists='fail', index=True,
419
412
If a DBAPI2 object, only sqlite3 is supported.
420
413
flavor : {'sqlite', 'mysql'}, default 'sqlite'
421
414
The flavor of SQL to use. Ignored when using SQLAlchemy engine.
422
- Required when using DBAPI2 connection.
423
- 'mysql' is still supported, but will be removed in future versions .
415
+ 'mysql' is deprecated and will be removed in future versions, but it
416
+ will be further supported through SQLAlchemy engines .
424
417
if_exists : {'fail', 'replace', 'append'}, default 'fail'
425
418
- fail: If table exists, do nothing.
426
419
- replace: If table exists, drop it, recreate it, and insert data.
@@ -461,8 +454,8 @@ def has_table(table_name, con, flavor='sqlite'):
461
454
If a DBAPI2 object, only sqlite3 is supported.
462
455
flavor: {'sqlite', 'mysql'}, default 'sqlite'
463
456
The flavor of SQL to use. Ignored when using SQLAlchemy engine.
464
- Required when using DBAPI2 connection.
465
- 'mysql' is still supported, but will be removed in future versions .
457
+ 'mysql' is deprecated and will be removed in future versions, but it
458
+ will be further supported through SQLAlchemy engines .
466
459
467
460
Returns
468
461
-------
@@ -1090,15 +1083,23 @@ def _create_sql_schema(self, frame, table_name):
1090
1083
1091
1084
def get_schema (frame , name , flavor = 'sqlite' , keys = None , con = None ):
1092
1085
"""
1093
- Get the SQL db table schema for the given frame
1086
+ Get the SQL db table schema for the given frame.
1094
1087
1095
1088
Parameters
1096
1089
----------
1097
1090
frame : DataFrame
1098
- name : name of SQL table
1091
+ name : string
1092
+ name of SQL table
1099
1093
flavor : {'sqlite', 'mysql'}, default 'sqlite'
1100
- keys : columns to use a primary key
1094
+ The flavor of SQL to use. Ignored when using SQLAlchemy engine.
1095
+ 'mysql' is deprecated and will be removed in future versions, but it
1096
+ will be further supported through SQLAlchemy engines.
1097
+ keys : string or sequence
1098
+ columns to use a primary key
1101
1099
con: an open SQL database connection object or an SQLAlchemy engine
1100
+ Using SQLAlchemy makes it possible to use any DB supported by that
1101
+ library.
1102
+ If a DBAPI2 object, only sqlite3 is supported.
1102
1103
1103
1104
"""
1104
1105
0 commit comments