18
18
import numpy as np
19
19
import pytest
20
20
21
- from pandas ._config import using_string_dtype
22
-
23
21
from pandas ._libs import lib
24
22
from pandas .compat import pa_version_under14p1
25
23
from pandas .compat ._optional import import_optional_dependency
60
58
pytest .mark .filterwarnings (
61
59
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
62
60
),
63
- pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False ),
64
61
]
65
62
66
63
@@ -682,6 +679,7 @@ def postgresql_psycopg2_conn(postgresql_psycopg2_engine):
682
679
683
680
@pytest .fixture
684
681
def postgresql_adbc_conn ():
682
+ pytest .importorskip ("pyarrow" )
685
683
pytest .importorskip ("adbc_driver_postgresql" )
686
684
from adbc_driver_postgresql import dbapi
687
685
@@ -814,6 +812,7 @@ def sqlite_conn_types(sqlite_engine_types):
814
812
815
813
@pytest .fixture
816
814
def sqlite_adbc_conn ():
815
+ pytest .importorskip ("pyarrow" )
817
816
pytest .importorskip ("adbc_driver_sqlite" )
818
817
from adbc_driver_sqlite import dbapi
819
818
@@ -984,12 +983,17 @@ def test_dataframe_to_sql(conn, test_frame1, request):
984
983
@pytest .mark .parametrize ("conn" , all_connectable )
985
984
def test_dataframe_to_sql_empty (conn , test_frame1 , request ):
986
985
if conn == "postgresql_adbc_conn" :
987
- request .node .add_marker (
988
- pytest .mark .xfail (
989
- reason = "postgres ADBC driver cannot insert index with null type" ,
990
- strict = True ,
986
+ adbc_driver_postgresql = pytest .importorskip ("adbc_driver_postgresql" )
987
+
988
+ if Version (adbc_driver_postgresql .__version__ ) < Version ("1.2" ):
989
+ request .node .add_marker (
990
+ pytest .mark .xfail (
991
+ reason = (
992
+ "postgres ADBC driver < 1.2 cannot insert index with null type" ,
993
+ )
994
+ )
991
995
)
992
- )
996
+
993
997
# GH 51086 if conn is sqlite_engine
994
998
conn = request .getfixturevalue (conn )
995
999
empty_df = test_frame1 .iloc [:0 ]
@@ -3554,7 +3558,8 @@ def test_read_sql_dtype_backend(
3554
3558
result = getattr (pd , func )(
3555
3559
f"Select * from { table } " , conn , dtype_backend = dtype_backend
3556
3560
)
3557
- expected = dtype_backend_expected (string_storage , dtype_backend , conn_name )
3561
+ expected = dtype_backend_expected (string_storage , dtype_backend , conn_name )
3562
+
3558
3563
tm .assert_frame_equal (result , expected )
3559
3564
3560
3565
if "adbc" in conn_name :
@@ -3604,7 +3609,7 @@ def test_read_sql_dtype_backend_table(
3604
3609
3605
3610
with pd .option_context ("mode.string_storage" , string_storage ):
3606
3611
result = getattr (pd , func )(table , conn , dtype_backend = dtype_backend )
3607
- expected = dtype_backend_expected (string_storage , dtype_backend , conn_name )
3612
+ expected = dtype_backend_expected (string_storage , dtype_backend , conn_name )
3608
3613
tm .assert_frame_equal (result , expected )
3609
3614
3610
3615
if "adbc" in conn_name :
@@ -4120,7 +4125,7 @@ def tquery(query, con=None):
4120
4125
def test_xsqlite_basic (sqlite_buildin ):
4121
4126
frame = DataFrame (
4122
4127
np .random .default_rng (2 ).standard_normal ((10 , 4 )),
4123
- columns = Index (list ("ABCD" ), dtype = object ),
4128
+ columns = Index (list ("ABCD" )),
4124
4129
index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
4125
4130
)
4126
4131
assert sql .to_sql (frame , name = "test_table" , con = sqlite_buildin , index = False ) == 10
@@ -4147,7 +4152,7 @@ def test_xsqlite_basic(sqlite_buildin):
4147
4152
def test_xsqlite_write_row_by_row (sqlite_buildin ):
4148
4153
frame = DataFrame (
4149
4154
np .random .default_rng (2 ).standard_normal ((10 , 4 )),
4150
- columns = Index (list ("ABCD" ), dtype = object ),
4155
+ columns = Index (list ("ABCD" )),
4151
4156
index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
4152
4157
)
4153
4158
frame .iloc [0 , 0 ] = np .nan
@@ -4170,7 +4175,7 @@ def test_xsqlite_write_row_by_row(sqlite_buildin):
4170
4175
def test_xsqlite_execute (sqlite_buildin ):
4171
4176
frame = DataFrame (
4172
4177
np .random .default_rng (2 ).standard_normal ((10 , 4 )),
4173
- columns = Index (list ("ABCD" ), dtype = object ),
4178
+ columns = Index (list ("ABCD" )),
4174
4179
index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
4175
4180
)
4176
4181
create_sql = sql .get_schema (frame , "test" )
@@ -4191,7 +4196,7 @@ def test_xsqlite_execute(sqlite_buildin):
4191
4196
def test_xsqlite_schema (sqlite_buildin ):
4192
4197
frame = DataFrame (
4193
4198
np .random .default_rng (2 ).standard_normal ((10 , 4 )),
4194
- columns = Index (list ("ABCD" ), dtype = object ),
4199
+ columns = Index (list ("ABCD" )),
4195
4200
index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
4196
4201
)
4197
4202
create_sql = sql .get_schema (frame , "test" )
0 commit comments