Skip to content

ENH/SQL: Allow 'dtype' argument in to_sql() to take dictionary including a default datatype #39013

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

Closed
nabelekt opened this issue Jan 7, 2021 · 2 comments
Labels
Enhancement Needs Discussion Requires discussion from core team before further action Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@nabelekt
Copy link

nabelekt commented Jan 7, 2021

Related to #11886

Could we modify the dictionary interpretation in to_sql() so that the datatype specified by a key like 'default' would apply to all other columns not already specified in the dictionary? Or, alternatively, we could break this out to two different arguments: a dictionary for specific columns and a datatype for all the rest?

Instead of choosing between specifying every column having a specific type and using one datatype for all columns, I need a hybrid of the two.

@nabelekt nabelekt added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 7, 2021
@jreback
Copy link
Contributor

jreback commented Jan 7, 2021

-1 we don't do this anywhere else

just construct a dtype dict yourself

@mroeschke mroeschke added the Needs Discussion Requires discussion from core team before further action label Jan 7, 2021
@mroeschke
Copy link
Member

Thanks for the suggestion, but agreed that pandas tries to promote explicitness, so having a default dtype setting would detract from that goal (add maybe overlap with a column with whatever key we would standardize around). Since there hasn't been much support for this functionality from other core developers, closing, but happy to reopen if there's revived interest from the team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Discussion Requires discussion from core team before further action Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

3 participants