Skip to content

Malformed data being sent to the database #2

Description

@gchilczuk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions