MCPcopy
hub / github.com/pandas-dev/pandas / test_to_sql_exist_fail

Function test_to_sql_exist_fail

pandas/tests/io/test_sql.py:1096–1104  ·  view source on GitHub ↗
(conn, test_frame1, request)

Source from the content-addressed store, hash-verified

1094
1095@pytest.mark.parametrize("conn", all_connectable)
1096def test_to_sql_exist_fail(conn, test_frame1, request):
1097 conn = request.getfixturevalue(conn)
1098 with pandasSQL_builder(conn, need_transaction=True) as pandasSQL:
1099 pandasSQL.to_sql(test_frame1, "test_frame", if_exists="fail")
1100 assert pandasSQL.has_table("test_frame")
1101
1102 msg = "Table 'test_frame' already exists"
1103 with pytest.raises(ValueError, match=msg):
1104 pandasSQL.to_sql(test_frame1, "test_frame", if_exists="fail")
1105
1106
1107@pytest.mark.parametrize("conn", all_connectable_iris)

Callers

nothing calls this directly

Calls 4

pandasSQL_builderFunction · 0.90
to_sqlMethod · 0.45
has_tableMethod · 0.45
raisesMethod · 0.45

Tested by

no test coverage detected