-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Document existing functionality of pandas.DataFrame.to_sql() #11886 #26795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
12591d1
4397fc7
e9b09c6
d7990f2
47bafad
53a364f
d535914
680ed87
ac44371
52a6782
4cfee29
00d6a25
13633be
82ebc5c
4700af9
9eee1cf
63ed2e3
b03e22f
00a081b
efa97be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import operator | ||
import pickle | ||
from textwrap import dedent | ||
from typing import Callable, FrozenSet, List, Set | ||
from typing import Callable, FrozenSet, List, Optional, Set, Union | ||
import warnings | ||
import weakref | ||
|
||
|
@@ -2458,8 +2458,12 @@ def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs): | |
return packers.to_msgpack(path_or_buf, self, encoding=encoding, | ||
**kwargs) | ||
|
||
def to_sql(self, name, con, schema=None, if_exists='fail', index=True, | ||
index_label=None, chunksize=None, dtype=None, method=None): | ||
def to_sql(self, name: str, con, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry should have asked this before but can you put each parameter on a separate line? Will help with readability There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Also added |
||
schema: Optional[str] = None, if_exists: str = 'fail', | ||
oguzhanogreden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
index: bool = True, | ||
index_label: Optional[Union[str, List[str]]] = None, | ||
chunksize: Optional[int] = None, dtype: Union[dict] = None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
method: Union[str, Callable] = None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to match this up with exact types (see the documentation for method) |
||
""" | ||
Write records stored in a DataFrame to a SQL database. | ||
|
||
|
@@ -2493,10 +2497,11 @@ def to_sql(self, name, con, schema=None, if_exists='fail', index=True, | |
chunksize : int, optional | ||
Rows will be written in batches of this size at a time. By default, | ||
all rows will be written at once. | ||
dtype : dict, optional | ||
Specifying the datatype for columns. The keys should be the column | ||
names and the values should be the SQLAlchemy types or strings for | ||
the sqlite3 legacy mode. | ||
dtype : dict or scalar, optional | ||
Specifying the datatype for columns. If a dictionary is used, the | ||
keys should be the column names and the values should be the | ||
SQLAlchemy types or strings for the sqlite3 legacy mode. If a | ||
scalar is provided, it will be applied to all columns. | ||
method : {None, 'multi', callable}, default None | ||
Controls the SQL insertion clause used: | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.