From b86c60c59d98ab527f602b0a8939e4054fdc1ff7 Mon Sep 17 00:00:00 2001 From: matthewhegarty Date: Thu, 11 Apr 2024 10:50:04 +0100 Subject: [PATCH] updated bulk testing docs --- docs/bulk_import.rst | 8 ++++---- docs/testing.rst | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/bulk_import.rst b/docs/bulk_import.rst index 1babe2d28..b1b270bdc 100644 --- a/docs/bulk_import.rst +++ b/docs/bulk_import.rst @@ -31,9 +31,9 @@ Caveats * In bulk mode, exceptions are not linked to a row. Any exceptions raised by bulk operations are logged and returned as critical (non-validation) errors (and re-raised if ``raise_errors`` is true). -* If you use :class:`~import_export.widgets.ForeignKeyWidget` then this can affect performance, because it reads from - the database for each row. If this is an issue then create a subclass which caches ``get_queryset()`` results rather - than reading for each invocation. +* If you use :class:`~import_export.widgets.ForeignKeyWidget` then this should not affect performance during lookups, + because the ``QuerySet`` cache should be used. Some more information + `here `_. For more information, please read the Django documentation on `bulk_create() `_ and @@ -62,4 +62,4 @@ Consider the following if you need to improve the performance of imports. Testing ======= -Scripts are provided to enable testing and benchmarking of bulk imports. See :ref:`testing:Bulk testing`. \ No newline at end of file +Scripts are provided to enable testing and benchmarking of bulk imports. See :ref:`testing:Bulk testing`. diff --git a/docs/testing.rst b/docs/testing.rst index 07d644a63..eb9b9952c 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -55,4 +55,20 @@ You can then run the script as follows: # pass 'create', 'update' or 'delete' to run the single test ./manage.py runscript bulk_import --script-args create +Enable logging +^^^^^^^^^^^^^^ + +You can see console debug logging by updating the ``LOGGING`` block in `settings.py`:: + + LOGGING = { + "version": 1, + "handlers": {"console": {"class": "logging.StreamHandler"}}, + "root": { + "handlers": ["console"], + }, + "loggers": { + "django.db.backends": {"level": "DEBUG", "handlers": ["console"]}, + } + } +