Skip to main content

Import CSV files in the background

Project description

Production/Stable License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This module extends the standard CSV import functionality to import files in the background using the OCA/queue framework.

Table of contents

Usage

The user is presented with a new checkbox in the import screen. When selected, the import is delayed in a background job.

This job in turn splits the CSV file in chunks of minimum 100 lines (or more to align with record boundaries). Each chunk is then imported in a separate background job.

When an import fails, the job is marked as such and the user can read the error in the job status. The CSV chunk being imported is stored as an attachment to the job, making it easy to download it, fix it and run a new import, possibly in synchronous mode since the chunks are small.

Any file that can be imported by the standard import mechanism can also be imported in the background.

This module’s scope is limited to making standard imports asynchronous. It does not attempt to transform the data nor automate ETL flows.

Other modules may benefit from this infrastructure in the following way (as illustrated in the test suite):

  1. create an instance of base_import.import and populate its fields (res_model, file, file_name),

  2. invoke the do method with appropriate options (header, encoding, separator, quoting, use_queue, chunk_size).

Known issues / Roadmap

  • There is currently no user interface to control the chunk size, which is currently 100 by default. Should this proves to be an issue, it is easy to add an option to extend the import screen.

  • Validation cannot be run in the background.

Changelog

13.0.1.0.0 (2019-12-20)

  • [MIGRATION] from 12.0 branched at rev. a7f8031

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Akretion

  • ACSONE SA/NV

Contributors

Sébastien Beau (Akretion) authored the initial prototype.

Stéphane Bidoul (ACSONE) extended it to version 1.0 to support multi-line records, store data to import as attachments and let the user control the asynchronous behaviour.

Other contributors include:

  • Anthony Muschang (ACSONE)

  • David Béal (Akretion)

  • Jonathan Nemry (ACSONE)

  • Laurent Mignon (ACSONE)

  • Dennis Sluijk (Onestein)

  • Guewen Baconnier (Camptocamp)

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/queue project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file odoo13_addon_base_import_async-13.0.2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo13_addon_base_import_async-13.0.2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ead81eb9ba8926c4a021161d0bd1652546a0e18102ae9c815bc30d451ff41e4a
MD5 3fa870b6a7da0af9651c8d1c7574efd7
BLAKE2b-256 5dd3df1799b96fd1cf8002eb6dcf000b91e42671e1b815cba620949817b0b4ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page