-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
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:
@contextmanager
def connection():
bcp_connection = bcp.Connection(
server="*", username="*", password="*", database="*", batchsize=16,
)
yield bcp_connection
bcp_connection.disconnect()
def main():
datasets = [
[[1, 1], [2, 2]],
[[5, 5], [6, 6]],
[[1, 1], [2, 2]] # this should cause a PK conflict
]
with connection() as bcp_connection:
for data in datasets:
bcp_connection.init(TABLE)
for row in data:
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels