Closed sathoro closed 7 years ago
Hey @sathoro thanks for contributing! I'll work on adding in your changes for the next release.
@wesokes Great! By the way, is there interest in supporting passing in a list of dicts instead of model objects to upsert? I patched the code to allow that because I found there is a substantial performance difference when dealing with a large number of objects.
@sathoro definitely interested in the list of dicts! we have been working on optimizing the speed of another project and noticed the huge improvement when avoiding models.
@wesokes Cool I also made a change so that it will optionally return a boolean for each row indicating whether it was inserted (as opposed to updated) so I can include that as well.
@sathoro i included these suggested changes in https://github.com/ambitioninc/django-query-builder/pull/88 and added a little bit more to the test. the next release will be 0.15.0 which includes django support up to 1.11 (and fixed the 2.0 warnings) as well as python 3.6.
Currently if you have a field where you specify a db_column and try to upsert it will throw an AttributeError. This change fixes that by using the field's
attname
instead ofcolumn
to get the value.The only case this this would break backwards compatibility that I can think of is if a model has a property defined on it with the same name as the
attname
but I think that this is the more sane default in that situation as well.