Accept sqlalchemy.engine.Engine
for SQL IO API (read_sql
, to_sql
)
#281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Outline
The typecheck for sql io api developed in 4c97ed3 does not accept
sqlalchemy.engine.Engine
for the argumentcon
.However, the original pandas implementation accepts them
In fact,
pandasSQL_builder
, which is used into_sql
andread_sql
, requiressqlalchemy.engine.Connectable
not onlysqlalchemy.engine.Connection
:https://github.com/pandas-dev/pandas/blob/50c119dce9005cb3e49c0cfb89f396aeecab94f1/pandas/io/sql.py#L757
So, in this PR, I improve the typecheck wider, and introduce testcodes for the case of sqlalchemy connection.
Check List
assert_type()
to assert the type of any return valueThis is my first pull request for this repository, so I apologize if there are any problems. I would appreciate it if you could check it.