Skip to content

DataFrame.to_sql generated text field that could not be used by "group by". (MS sql) #7957

Open
@NathanielCapital

Description

@NathanielCapital

In _sqlalchemy_type function, pandas import Text type from sqlalchemy as the default type when generating text field in SQL table, which is transformed into "text" type in microsoft sql. This type could not be used by "group by" in SQL query.
SQL query with a group by clause with the field generate an error msg like:

Msg 306, Level 16, State 2, Line 3
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

I tried default text field to be the String, which works for MS sql.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions