def to_sql(frame, name, con, flavor=None, schema=None, if_exists='fail', index=True, index_label=None, chunksize=None, dtype=None):
 if (if_exists not in ('fail', 'replace', 'append')):
  raise ValueError("'{0}' is not valid for if_exists".format(if_exists))
 pandas_sql = pandasSQL_builder(con, schema=schema, flavor=flavor)
 if isinstance(frame, Series):
  frame = frame.to_frame()
 elif (not isinstance(frame, DataFrame)):
  raise NotImplementedError("'frame' argument should be either a Series or a DataFrame")
 pandas_sql.to_sql(frame, name, if_exists=if_exists, index=index, index_label=index_label, schema=schema, chunksize=chunksize, dtype=dtype)

def to_sql ( frame , name , con , flavor = None , schema = None , if_exists = 'fail' , index = True , index_label = None , chunksize = None , dtype = None ) : if ( if_exists not in ( 'fail' , 'replace' , 'append' ) ) : raise ValueError ( "'{0}' is not valid for if_exists" . format ( if_exists ) ) pandas_sql = pandasSQL_builder ( con , schema = schema , flavor = flavor ) if isinstance ( frame , Series ) : frame = frame . to_frame ( ) elif ( not isinstance ( frame , DataFrame ) ) : raise NotImplementedError ( "'frame' argument should be either a Series or a DataFrame" ) pandas_sql . to_sql ( frame , name , if_exists = if_exists , index = index , index_label = index_label , schema = schema , chunksize = chunksize , dtype = dtype )
write records stored in a dataframe to a sql database .