I'm not sure how much it's a bug and how much some kind of "undocumented behavior".
environment: CentOS 7, Python 3.7.7, package installed with pip install .
My code:
@contextmanagerdefconnection():
bcp_connection=bcp.Connection(
server="*", username="*", password="*", database="*", batchsize=16,
)
yieldbcp_connectionbcp_connection.disconnect()
defmain():
datasets= [
[[1, 1], [2, 2]],
[[5, 5], [6, 6]],
[[1, 1], [2, 2]] # this should cause a PK conflict
]
withconnection() asbcp_connection:
fordataindatasets:
bcp_connection.init(TABLE)
forrowindata:
bcp_connection.send(row)
bcp_connection.commit()
if__name__=="__main__":
main()
Final result in database is:
1 1
2 2
35848246 35848246
1726742581 1726742581
35848242 35848242
1726742577 1726742577
Everything works as it should when I make a reconnection after each commit.
I'm not sure how much it's a bug and how much some kind of "undocumented behavior".
environment: CentOS 7, Python 3.7.7, package installed with
pip install .My code:
Final result in database is:
Everything works as it should when I make a reconnection after each commit.