DOC: Document existing functionality of pandas.DataFrame.to_sql() #11886 by oguzhanogreden · Pull Request #26795 · pandas-dev/pandas (original) (raw)
Makes sense as sqlite3 is part of the stdlib whereas sqlalchemy is a third party package and I don’t think on typeshed.
Sent from my iPhone
On Jun 17, 2019, at 11:56 AM, Oğuzhan Öğreden ***@***.***> wrote:@oguzhanogreden commented on this pull request. In pandas/core/generic.py: > @@ -2458,8 +2462,22 @@ 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): + # TODO: Replace `con: Any` and `Callable[[Any, Any, ...` when SQLTable + # and sqlalchemy can be imported. SQLTable can't be imported due to I got the correct type for sqlite3 when I tried reveal_type(). @WillAyd did you notice the if TYPE_CHECKING: imports? It seems I'm making a mistake with sqlalchemy though, since it's revealed as Any as you mentioned. pandas\core\generic.py:2619: error: Revealed type is 'Union[Any, sqlite3.dbapi2.Connection]' pandas\core\generic.py:2620: error: Revealed type is 'Union[builtins.str, def (pandas.io.sql.SQLTable, Union[Any, sqlite3.dbapi2.Connection], builtins.list[builtins.str], typing.Iterator[builtins.list[Any]]), None]' I'll figure sqlalchemy types out and make sure this passes the tests out. Also, here is the cross-module example: https://mypy.readthedocs.io/en/latest/common_issues.html#import-cycles — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.