Skip to content

to_sql doesn't seem to allow upload of df with some columns when the target table has a calculated column #60609

@qzoxec

Description

@qzoxec

I am trying to append a dataframe with several columns to a MS SQL table with a calculated field. I get the following error on attempt:
"sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The column "Fieldname" cannot be modified because it is either a computed column or is the result of a UNION operator. (271) (SQLExecDirectW); [42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Statement(s) could not be prepared. (8180)')"

This issue seems to have been addressed in the AWS sdk using the use_column_names parameter. See here - aws/aws-sdk-pandas#2170

That parameter doesn't seem to exist when using a sqlalchemy pyodbc connection. - "TypeError: to_sql() got an unexpected keyword argument 'use_column_names'"

Is there something similar that exists for a sqlalchemy pyodbc connection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions