@@ -3848,12 +3848,13 @@ def test_read_sql_dtype(conn, request, func, dtype_backend):
3848
3848
3849
3849
def test_bigint_warning (sqlite_engine ):
3850
3850
conn = sqlite_engine
3851
+ table_uuid = table_uuid_gen ("test_bigintwarning" )
3851
3852
# test no warning for BIGINT (to support int64) is raised (GH7433)
3852
3853
df = DataFrame ({"a" : [1 , 2 ]}, dtype = "int64" )
3853
- assert df .to_sql (name = "test_bigintwarning" , con = conn , index = False ) == 2
3854
+ assert df .to_sql (name = table_uuid , con = conn , index = False ) == 2
3854
3855
3855
3856
with tm .assert_produces_warning (None ):
3856
- sql .read_sql_table ("test_bigintwarning" , conn )
3857
+ sql .read_sql_table (table_uuid , conn )
3857
3858
3858
3859
3859
3860
def test_valueerror_exception (sqlite_engine ):
@@ -3865,6 +3866,7 @@ def test_valueerror_exception(sqlite_engine):
3865
3866
3866
3867
def test_row_object_is_named_tuple (sqlite_engine ):
3867
3868
conn = sqlite_engine
3869
+ table_uuid = table_uuid_gen ("test_frame" )
3868
3870
# GH 40682
3869
3871
# Test for the is_named_tuple() function
3870
3872
# Placed here due to its usage of sqlalchemy
@@ -3882,7 +3884,7 @@ def test_row_object_is_named_tuple(sqlite_engine):
3882
3884
BaseModel = declarative_base ()
3883
3885
3884
3886
class Test (BaseModel ):
3885
- __tablename__ = "test_frame"
3887
+ __tablename__ = table_uuid
3886
3888
id = Column (Integer , primary_key = True )
3887
3889
string_column = Column (String (50 ))
3888
3890
@@ -3892,7 +3894,7 @@ class Test(BaseModel):
3892
3894
with Session () as session :
3893
3895
df = DataFrame ({"id" : [0 , 1 ], "string_column" : ["hello" , "world" ]})
3894
3896
assert (
3895
- df .to_sql (name = "test_frame" , con = conn , index = False , if_exists = "replace" )
3897
+ df .to_sql (name = table_uuid , con = conn , index = False , if_exists = "replace" )
3896
3898
== 2
3897
3899
)
3898
3900
session .commit ()
@@ -3905,7 +3907,7 @@ class Test(BaseModel):
3905
3907
def test_read_sql_string_inference (sqlite_engine ):
3906
3908
conn = sqlite_engine
3907
3909
# GH#54430
3908
- table = "test"
3910
+ table = table_uuid_gen ( "test" )
3909
3911
df = DataFrame ({"a" : ["x" , "y" ]})
3910
3912
df .to_sql (table , con = conn , index = False , if_exists = "replace" )
3911
3913
@@ -3922,10 +3924,11 @@ def test_read_sql_string_inference(sqlite_engine):
3922
3924
3923
3925
def test_roundtripping_datetimes (sqlite_engine ):
3924
3926
conn = sqlite_engine
3927
+ table_uuid = table_uuid_gen ("test" )
3925
3928
# GH#54877
3926
3929
df = DataFrame ({"t" : [datetime (2020 , 12 , 31 , 12 )]}, dtype = "datetime64[ns]" )
3927
- df .to_sql ("test" , conn , if_exists = "replace" , index = False )
3928
- result = pd .read_sql ("select * from test " , conn ).iloc [0 , 0 ]
3930
+ df .to_sql (table_uuid , conn , if_exists = "replace" , index = False )
3931
+ result = pd .read_sql (f "select * from { table_uuid } " , conn ).iloc [0 , 0 ]
3929
3932
assert result == "2020-12-31 12:00:00.000000"
3930
3933
3931
3934
@@ -4061,17 +4064,18 @@ def test_self_join_date_columns(postgresql_psycopg2_engine):
4061
4064
4062
4065
def test_create_and_drop_table (sqlite_engine ):
4063
4066
conn = sqlite_engine
4067
+ table_uuid = table_uuid_gen ("drop_test_frame" )
4064
4068
temp_frame = DataFrame ({"one" : [1.0 , 2.0 , 3.0 , 4.0 ], "two" : [4.0 , 3.0 , 2.0 , 1.0 ]})
4065
4069
with sql .SQLDatabase (conn ) as pandasSQL :
4066
4070
with pandasSQL .run_transaction ():
4067
- assert pandasSQL .to_sql (temp_frame , "drop_test_frame" ) == 4
4071
+ assert pandasSQL .to_sql (temp_frame , table_uuid ) == 4
4068
4072
4069
- assert pandasSQL .has_table ("drop_test_frame" )
4073
+ assert pandasSQL .has_table (table_uuid )
4070
4074
4071
4075
with pandasSQL .run_transaction ():
4072
- pandasSQL .drop_table ("drop_test_frame" )
4076
+ pandasSQL .drop_table (table_uuid )
4073
4077
4074
- assert not pandasSQL .has_table ("drop_test_frame" )
4078
+ assert not pandasSQL .has_table (table_uuid )
4075
4079
4076
4080
4077
4081
def test_sqlite_datetime_date (sqlite_buildin ):
0 commit comments