You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
In SQL Server, just not including the computed column in the dataframe you are passing through to_sql should work, assuming you're using if_exists='append' (I assume you must be because you have a computed column, which pandas would not create on its own).
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?
The text was updated successfully, but these errors were encountered: