Skip to content

include column names into the insert when use to_sql  #545

@yyie

Description

@yyie

Hi, I found that if you have an existing table and want to append a dataset using "to_sql" without including the primary key, the INSERT fails. This is because the name of the columns is not included in the generated INSERT.

The INSERT used in this moment has this fomr

sql: str = f"INSERT INTO {table_identifier} VALUES ({placeholders})"

It should be something like

sql: str = f"INSERT INTO {table_identifier} ({column_names}) VALUES ({placeholders})"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions