Skip to content

Conversation

@NMAC427
Copy link
Contributor

@NMAC427 NMAC427 commented Jun 26, 2023

@mroeschke mroeschke added IO SQL to_sql, read_sql, read_sql_query Arrow pyarrow functionality labels Jun 26, 2023
@mroeschke mroeschke modified the milestone: 2.1 Jun 26, 2023
pandas/io/sql.py Outdated

if pa.types.is_date(ser.dtype.pyarrow_dtype):
# GH#53854 to_pydatetime not supported for pyarrow date dtypes
d = ser._values.astype(object)
Copy link
Member

Choose a reason for hiding this comment

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

Could you use ser._values.to_numpy(dtype=object)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just pushed a new commit with the requested changes.

@mroeschke mroeschke added this to the 2.1 milestone Jun 26, 2023
@mroeschke mroeschke merged commit b126638 into pandas-dev:main Jun 26, 2023
@mroeschke
Copy link
Member

Thanks @NMAC427

Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
…ev#53856) * BUG: to_sql fails for pyarrow date dtype (pandas-dev#53854) * use ArrowExtensionArray.to_numpy instead of ArrowExtensionArray.astype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arrow pyarrow functionality IO SQL to_sql, read_sql, read_sql_query

2 participants