@@ -989,13 +989,47 @@ def read_frame(*args, **kwargs):
989
989
return read_sql (* args , ** kwargs )
990
990
991
991
992
- def write_frame (* args , ** kwargs ):
992
+ def write_frame (frame , name , con , flavor = 'sqlite' , if_exists = 'fail' , ** kwargs ):
993
993
"""DEPRECIATED - use to_sql
994
+
995
+ Write records stored in a DataFrame to a SQL database.
996
+
997
+ Parameters
998
+ ----------
999
+ frame : DataFrame
1000
+ name : string
1001
+ con : DBAPI2 connection
1002
+ flavor : {'sqlite', 'mysql'}, default 'sqlite'
1003
+ The flavor of SQL to use.
1004
+ if_exists : {'fail', 'replace', 'append'}, default 'fail'
1005
+ - fail: If table exists, do nothing.
1006
+ - replace: If table exists, drop it, recreate it, and insert data.
1007
+ - append: If table exists, insert data. Create if does not exist.
1008
+ index : boolean, default False
1009
+ Write DataFrame index as a column
1010
+
1011
+ Notes
1012
+ -----
1013
+ This function is deprecated in favor of ``to_sql``. There are however
1014
+ two differences:
1015
+
1016
+ - With ``to_sql`` the index is written to the sql database by default. To
1017
+ keep the behaviour this function you need to specify ``index=False``.
1018
+ - The new ``to_sql`` function supports sqlalchemy engines to work with
1019
+ different sql flavors.
1020
+
1021
+ See also
1022
+ --------
1023
+ pandas.DataFrame.to_sql
1024
+
994
1025
"""
995
1026
warnings .warn ("write_frame is depreciated, use to_sql" , DeprecationWarning )
996
- return to_sql (* args , ** kwargs )
1027
+
1028
+ # for backwards compatibility, set index=False when not specified
1029
+ index = kwargs .pop ('index' , False )
1030
+ return to_sql (frame , name , con , flavor = flavor , if_exists = if_exists ,
1031
+ index = index , ** kwargs )
997
1032
998
1033
999
1034
# Append wrapped function docstrings
1000
1035
read_frame .__doc__ += read_sql .__doc__
1001
- write_frame .__doc__ += to_sql .__doc__
0 commit comments