You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using a list of dicts for .bulk_create() where the keys for the individual dicts are not in exactly the same order will result in data inconsistency errors.
This may also trigger an exception for Type insertion, eg trying to insert am int into a uuid column.
To Reproduce
The following will insert the wrong values into the particular columns regardless of the key name. This is a result of the key order being taken from the first dict and then that same order being applied against all other dicts.
I am putting together a PR to address this by simply sorting the keys in each dict
before passing them to the grammar compiler
Expected behavior
The values associated with each key in eack dict should be inerted in the correct column regardless of the order of the keys in each dict.
Desktop (please complete the following information):
OS: OSX
Version 12.4
What database are you using?
Type: Postgres
Version 10.5
Masonite ORM 2.18.1
The text was updated successfully, but these errors were encountered:
circulon
changed the title
bulk_create() expects key order of dicts in list to be the same
bulk_create() expects same column order for all data
Jul 23, 2022
Describe the bug
Using a list of dicts for
.bulk_create()
where the keys for the individual dicts are not in exactly the same order will result in data inconsistency errors.This may also trigger an exception for Type insertion, eg trying to insert am
int
into auuid
column.To Reproduce
The following will insert the wrong values into the particular columns regardless of the key name. This is a result of the key order being taken from the first dict and then that same order being applied against all other dicts.
This will result in 3 rows being created with the following data
I am putting together a PR to address this by simply sorting the keys in each dict
before passing them to the grammar compiler
Expected behavior
The values associated with each key in eack dict should be inerted in the correct column regardless of the order of the keys in each dict.
Desktop (please complete the following information):
What database are you using?
The text was updated successfully, but these errors were encountered: