@@ -41,24 +41,6 @@ class DatabaseError(IOError):
41
41
_SQLALCHEMY_INSTALLED = None
42
42
43
43
44
- def _validate_flavor_parameter (flavor ):
45
- """
46
- Checks whether a database 'flavor' was specified.
47
- If not None, produces FutureWarning if 'sqlite' and
48
- raises a ValueError if anything else.
49
- """
50
- if flavor is not None :
51
- if flavor == 'sqlite' :
52
- warnings .warn ("the 'flavor' parameter is deprecated "
53
- "and will be removed in a future version, "
54
- "as 'sqlite' is the only supported option "
55
- "when SQLAlchemy is not installed." ,
56
- FutureWarning , stacklevel = 2 )
57
- else :
58
- raise ValueError ("database flavor {flavor} is not "
59
- "supported" .format (flavor = flavor ))
60
-
61
-
62
44
def _is_sqlalchemy_connectable (con ):
63
45
global _SQLALCHEMY_INSTALLED
64
46
if _SQLALCHEMY_INSTALLED is None :
@@ -415,8 +397,8 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
415
397
chunksize = chunksize )
416
398
417
399
418
- def to_sql (frame , name , con , flavor = None , schema = None , if_exists = 'fail' ,
419
- index = True , index_label = None , chunksize = None , dtype = None ):
400
+ def to_sql (frame , name , con , schema = None , if_exists = 'fail' , index = True ,
401
+ index_label = None , chunksize = None , dtype = None ):
420
402
"""
421
403
Write records stored in a DataFrame to a SQL database.
422
404
@@ -430,10 +412,6 @@ def to_sql(frame, name, con, flavor=None, schema=None, if_exists='fail',
430
412
Using SQLAlchemy makes it possible to use any DB supported by that
431
413
library.
432
414
If a DBAPI2 object, only sqlite3 is supported.
433
- flavor : 'sqlite', default None
434
- .. deprecated:: 0.19.0
435
- 'sqlite' is the only supported option if SQLAlchemy is not
436
- used.
437
415
schema : string, default None
438
416
Name of SQL schema in database to write to (if database flavor
439
417
supports this). If None, use default schema (default).
@@ -459,7 +437,7 @@ def to_sql(frame, name, con, flavor=None, schema=None, if_exists='fail',
459
437
if if_exists not in ('fail' , 'replace' , 'append' ):
460
438
raise ValueError ("'{0}' is not valid for if_exists" .format (if_exists ))
461
439
462
- pandas_sql = pandasSQL_builder (con , schema = schema , flavor = flavor )
440
+ pandas_sql = pandasSQL_builder (con , schema = schema )
463
441
464
442
if isinstance (frame , Series ):
465
443
frame = frame .to_frame ()
@@ -472,7 +450,7 @@ def to_sql(frame, name, con, flavor=None, schema=None, if_exists='fail',
472
450
chunksize = chunksize , dtype = dtype )
473
451
474
452
475
- def has_table (table_name , con , flavor = None , schema = None ):
453
+ def has_table (table_name , con , schema = None ):
476
454
"""
477
455
Check if DataBase has named table.
478
456
@@ -484,10 +462,6 @@ def has_table(table_name, con, flavor=None, schema=None):
484
462
Using SQLAlchemy makes it possible to use any DB supported by that
485
463
library.
486
464
If a DBAPI2 object, only sqlite3 is supported.
487
- flavor : 'sqlite', default None
488
- .. deprecated:: 0.19.0
489
- 'sqlite' is the only supported option if SQLAlchemy is not
490
- installed.
491
465
schema : string, default None
492
466
Name of SQL schema in database to write to (if database flavor supports
493
467
this). If None, use default schema (default).
@@ -496,7 +470,7 @@ def has_table(table_name, con, flavor=None, schema=None):
496
470
-------
497
471
boolean
498
472
"""
499
- pandas_sql = pandasSQL_builder (con , flavor = flavor , schema = schema )
473
+ pandas_sql = pandasSQL_builder (con , schema = schema )
500
474
return pandas_sql .has_table (table_name )
501
475
502
476
@@ -521,14 +495,12 @@ def _engine_builder(con):
521
495
return con
522
496
523
497
524
- def pandasSQL_builder (con , flavor = None , schema = None , meta = None ,
498
+ def pandasSQL_builder (con , schema = None , meta = None ,
525
499
is_cursor = False ):
526
500
"""
527
501
Convenience function to return the correct PandasSQL subclass based on the
528
502
provided parameters.
529
503
"""
530
- _validate_flavor_parameter (flavor )
531
-
532
504
# When support for DBAPI connections is removed,
533
505
# is_cursor should not be necessary.
534
506
con = _engine_builder (con )
@@ -1378,9 +1350,7 @@ class SQLiteDatabase(PandasSQL):
1378
1350
1379
1351
"""
1380
1352
1381
- def __init__ (self , con , flavor = None , is_cursor = False ):
1382
- _validate_flavor_parameter (flavor )
1383
-
1353
+ def __init__ (self , con , is_cursor = False ):
1384
1354
self .is_cursor = is_cursor
1385
1355
self .con = con
1386
1356
@@ -1534,7 +1504,7 @@ def _create_sql_schema(self, frame, table_name, keys=None, dtype=None):
1534
1504
return str (table .sql_schema ())
1535
1505
1536
1506
1537
- def get_schema (frame , name , flavor = None , keys = None , con = None , dtype = None ):
1507
+ def get_schema (frame , name , keys = None , con = None , dtype = None ):
1538
1508
"""
1539
1509
Get the SQL db table schema for the given frame.
1540
1510
@@ -1549,15 +1519,11 @@ def get_schema(frame, name, flavor=None, keys=None, con=None, dtype=None):
1549
1519
Using SQLAlchemy makes it possible to use any DB supported by that
1550
1520
library, default: None
1551
1521
If a DBAPI2 object, only sqlite3 is supported.
1552
- flavor : 'sqlite', default None
1553
- .. deprecated:: 0.19.0
1554
- 'sqlite' is the only supported option if SQLAlchemy is not
1555
- installed.
1556
1522
dtype : dict of column name to SQL type, default None
1557
1523
Optional specifying the datatype for columns. The SQL type should
1558
1524
be a SQLAlchemy type, or a string for sqlite3 fallback connection.
1559
1525
1560
1526
"""
1561
1527
1562
- pandas_sql = pandasSQL_builder (con = con , flavor = flavor )
1528
+ pandas_sql = pandasSQL_builder (con = con )
1563
1529
return pandas_sql ._create_sql_schema (frame , name , keys = keys , dtype = dtype )
0 commit comments