Skip to content

BUG: _get_dtype doesn't recognize strings #55836

@yoavabadi5S

Description

@yoavabadi5S

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
# given an sqlalchemy query with a String column type
df = pd.read_sql(query.statement, query.session.bind)
# df.dtypes confirm dtype to be 'object'

Issue Description

The method _get_dtype doesn't recognize strings, see code:
https://github.com/pandas-dev/pandas/blob/master/pandas/io/sql.py#L1363C9-L1363C19

Expected Behavior

it should recognize string as str

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO SQLto_sql, read_sql, read_sql_queryNeeds InfoClarification about behavior needed to assess issueNeeds TriageIssue that has not been reviewed by a pandas team memberStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions