Skip to content

TYP: pandas/io/sql.py (easy: bool/str) #38537

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

Merged
merged 6 commits into from
Dec 21, 2020

Conversation

arw2019
Copy link
Member

@arw2019 arw2019 commented Dec 17, 2020

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

chunksize: Optional[str],
columns,
coerce_float: bool = True,
parse_dates=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this one correct? parse_dates

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't touch this, but looking through these read_sql methods parse_dates defaults to None in most (I think all) of those

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i pointed at the wrong one, this shouldn't be a bool type for parse_dates right? it takes a Optional[Dict[str, ....]]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes it's one up from here.

Fixed (removed the annotation - sticking to doing plain bool/str in this PR)

@jreback jreback added the Typing type annotations, mypy/pyright type checking label Dec 17, 2020
pandas/io/sql.py Outdated
@@ -77,7 +77,7 @@ def _process_parse_dates_argument(parse_dates):
return parse_dates


def _handle_date_column(col, utc=None, format=None):
def _handle_date_column(col, utc: Optional[bool] = None, format: Optional[str] = None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format is not right, itls something like Optional[Union[Dict[str, str], str]]

Copy link
Member Author

@arw2019 arw2019 Dec 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes definitely a mistake

I think it has to be Optional[Dict[str, Any]] because it ends up in

to_datetime(col, errors=error, **format)

Can also be str

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the fix

@jreback jreback added this to the 1.3 milestone Dec 21, 2020
@jreback jreback merged commit de3eef9 into pandas-dev:master Dec 21, 2020
@jreback
Copy link
Contributor

jreback commented Dec 21, 2020

thanks @arw2019

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants