Data ingestion in the database can be very slow, specially for large datasets. Setting up a scheduler like huey for that purpose will improve the user experience.
This should:
Add a status field and a ingestion logs field in the DataImport model that communicates the status of the ingestion to the user.
Move most of the contents of DataImport.clean to a separate function that is setup as @db_task and that updates the
Implement a post_save signal for the DataImport method that actually loads the data in the db asyncronously by calling this @db_task . This will update the fields indicated in 1 based on the status of the loading.
Obviously, huey should be properly added as a dependency and configured.
Data ingestion in the database can be very slow, specially for large datasets. Setting up a scheduler like
huey
for that purpose will improve the user experience.This should:
status
field and aingestion logs
field in theDataImport
model that communicates the status of the ingestion to the user.DataImport.clean
to a separate function that is setup as@db_task
and that updates thepost_save
signal for theDataImport
method that actually loads the data in the db asyncronously by calling this@db_task
. This will update the fields indicated in 1 based on the status of the loading.Obviously,
huey
should be properly added as a dependency and configured.