Support ASGI async export streams, refactor XLSX payload, add importer bulk-update and tests#46
Closed
Support ASGI async export streams, refactor XLSX payload, add importer bulk-update and tests#46
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
asgiref.sync.sync_to_asyncusage and helperTreeNodeExporter._get_sync_iterator_itemand async stream variantsasync_csv_stream_data,async_json_stream_data,async_yaml_stream_data, andasync_xlsx_stream_datatotreenode/admin/exporter.py._build_xlsx_payloadand adjustedxlsx_stream_datato yield the built payload, and added_resolve_stream_datato select async or sync stream plusprocess_record(request=None)to detect ASGI requests.treenode/admin/mixin.pyto pass therequestintoprocess_recordso the exporter can choose async streams for ASGI.treenode/admin/importer.pyto detect existing objects per level via_get_existing_objects_map, normalize parent references with_normalize_parent_reference, collectto_updateitems, and performbulk_updateusing_get_update_fields, while trackingresult['updated'].treenode/tests.pywithAdminExportAsyncTests(async export streaming) andTreeNodeImporterTests(import updates existing row), and added necessary imports and fixtures.Testing
treenode/tests.pyincludingtest_export_endpoint_uses_async_stream_without_warningandtest_import_tree_updates_existing_row_by_pk.treenode.tests) exercising async export and importer update paths.Codex Task