4545from pandas .core .dtypes .common import (
4646 is_dict_like ,
4747 is_list_like ,
48+ is_object_dtype ,
49+ is_string_dtype ,
4850)
4951from pandas .core .dtypes .dtypes import (
5052 ArrowDtype ,
5860 Series ,
5961)
6062from pandas .core .arrays import ArrowExtensionArray
63+ from pandas .core .arrays .string_ import StringDtype
6164from pandas .core .base import PandasObject
6265import pandas .core .common as com
6366from pandas .core .common import maybe_make_list
@@ -1316,7 +1319,12 @@ def _harmonize_columns(
13161319 elif dtype_backend == "numpy" and col_type is float :
13171320 # floats support NA, can always convert!
13181321 self .frame [col_name ] = df_col .astype (col_type )
1319-
1322+ elif (
1323+ using_string_dtype ()
1324+ and is_string_dtype (col_type )
1325+ and is_object_dtype (self .frame [col_name ])
1326+ ):
1327+ self .frame [col_name ] = df_col .astype (col_type )
13201328 elif dtype_backend == "numpy" and len (df_col ) == df_col .count ():
13211329 # No NA values, can convert ints and bools
13221330 if col_type is np .dtype ("int64" ) or col_type is bool :
@@ -1403,6 +1411,7 @@ def _get_dtype(self, sqltype):
14031411 DateTime ,
14041412 Float ,
14051413 Integer ,
1414+ String ,
14061415 )
14071416
14081417 if isinstance (sqltype , Float ):
@@ -1422,6 +1431,10 @@ def _get_dtype(self, sqltype):
14221431 return date
14231432 elif isinstance (sqltype , Boolean ):
14241433 return bool
1434+ elif isinstance (sqltype , String ):
1435+ if using_string_dtype ():
1436+ return StringDtype (na_value = np .nan )
1437+
14251438 return object
14261439
14271440
@@ -2205,7 +2218,7 @@ def read_table(
22052218 elif using_string_dtype ():
22062219 from pandas .io ._util import arrow_string_types_mapper
22072220
2208- arrow_string_types_mapper ()
2221+ mapping = arrow_string_types_mapper ()
22092222 else :
22102223 mapping = None
22112224
@@ -2286,6 +2299,10 @@ def read_query(
22862299 from pandas .io ._util import _arrow_dtype_mapping
22872300
22882301 mapping = _arrow_dtype_mapping ().get
2302+ elif using_string_dtype ():
2303+ from pandas .io ._util import arrow_string_types_mapper
2304+
2305+ mapping = arrow_string_types_mapper ()
22892306 else :
22902307 mapping = None
22912308
0 commit comments