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
* Implement can_return_rows_from_bulk_insert feature, returning ids or rows after bulk inserts.
* Since mssql-django supports Django 2.2, we also need the pre-Django 3.0 version of feature flag can_return_rows_from_bulk_insert (namely, can_return_ids_from_bulk_insert) (cf. https://docs.djangoproject.com/en/4.0/releases/3.0/#database-backend-api)
* My alternative changes on SQLInsertCompiler.as_sql.
Maybe a bit ambitious, as we completely forsake the SCOPE_IDENTITY strategy (dead code path - we keep the code here, but we could decide not to, really) in favor of OUTPUT strategy.
* Don't try to use the OUTPUT clause when inserting without fields
* Actually we don't really have to offer the feature for Django 2.2, so let's only set can_return_rows_from_bulk_insert to True and not can_return_ids_from_bulk_insert
* Tentative fix: when there are returning fields, but no fields (which means default values insertion - for n objects of course!), we must still fulfill our contract, and return the appropriate rows.
This means we won't use INSERT INTO (...) DEFAULT VALUES n times, but a single INSERT INTO (...) VALUES (DEFAULT, (...), DEFAULT), (...), (DEFAULT, (...), DEFAULT)
Also: be more thorough re the infamous feature flag rename from Django 3.0
* Using MERGE INTO to support Bulk Insertion of multiple rows into a table with only an IDENTITY column.
* Add a link to a reference web page.
* Attempt to make Django 2.2 tests pass
* Get back to a lighter diff of as_sql function vs. original
* Use a query to generate sequence of numbers instead of using the master....spt_values table.
* Update mssql/operations.py
Co-authored-by: marcperrinoptel <86617454+marcperrinoptel@users.noreply.github.com>
* Simplification & refactoring
Co-authored-by: marcperrinoptel <marc.perrin@optelgroup.com>
Co-authored-by: marcperrinoptel <86617454+marcperrinoptel@users.noreply.github.com>
0 commit comments