API Reference

This section provides an auto-generated API reference for the core components of the odoo-data-flow library.

Command-Line Interface (__main__)

This module contains the main click-based command-line interface.

odoo-data-flow

Odoo Data Flow: A tool for importing, exporting, and processing data.

odoo-data-flow [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

-v, --verbose

Enable verbose, debug-level logging.

--log-file <log_file>

Path to a file to write logs to, in addition to the console.

--flow-file <flow_file>

Path to the YAML flow file. Defaults to ‘flows.yml’ in current directory.

--run <flow_name>

Name of a specific flow to run from the flow file.

export

Runs the data export process.

odoo-data-flow export [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

--output <output>

Required Output file path.

--model <model>

Required Odoo model to export from.

--fields <fields>

Required Comma-separated list of fields to export. Special specifiers are available for IDs: ‘.id’ for raw database ID; ‘field/.id’ for related raw ID; ‘id’ for XML ID; ‘field/id’ for related XML ID. The tool automatically uses the best export method based on the fields requested.

--domain <domain>

Odoo domain filter as a list string.

--worker <worker>

Number of simultaneous connections.

--size <batch_size>

Number of records to process per batch.

--streaming

Enable streaming to write data batch-by-batch. Use for very large datasets.

--resume-session <resume_session>

Resume a previously failed export session using its ID.

-s, --sep <separator>

CSV separator character.

--context <context>

Odoo context as a dictionary string.

--encoding <encoding>

Encoding of the data file.

--technical-names

Force the use of the high-performance raw export mode. This is often enabled automatically if you request raw IDs or technical field types like ‘selection’ or ‘binary’.

import

Runs the data import process.

odoo-data-flow import [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

--file <filename>

Required File to import.

--model <model>

Odoo model to import into. If not provided, it’s inferred from the filename.

--deferred-fields <deferred_fields>

Comma-separated list of fields to defer to a second pass (enables two-pass import).

--unique-id-field <unique_id_field>

The column that uniquely identifies records (e.g., ‘xml_id’). Required for deferred imports.

--no-preflight-checks

Skip all pre-flight checks before starting the import.

--worker <worker>

Number of simultaneous connections.

--size <batch_size>

Number of lines to import per connection.

--skip <skip>

Number of initial lines to skip.

--fail

Run in fail mode, retrying records from the _fail.csv file.

--headless

Run in headless mode, auto-confirming any prompts (e.g., installing languages).

-s, --sep <separator>

CSV separator character.

--groupby <groupby>

Comma-separated list of columns to group data by to prevent deadlocks.Records with empty values for the first column are processed first, then grouped by that column. This process repeats for subsequent columns.

--ignore <ignore>

Comma-separated list of columns to ignore.

--context <context>

Odoo context as a JSON string e.g., ‘{“key”: true}’.

--o2m

Special handling for one-to-many imports.

--encoding <encoding>

Encoding of the data file.

migrate

Performs a direct server-to-server data migration.

odoo-data-flow migrate [OPTIONS]

Options

--config-export <config_export>

Required Path to the source Odoo connection config.

--config-import <config_import>

Required Path to the destination Odoo connection config.

--model <model>

Required The Odoo model to migrate.

--domain <domain>

Domain filter to select records for export.

--fields <fields>

Required Comma-separated list of fields to migrate.

--mapping <mapping>

A dictionary string defining the transformation mapping.

--export-worker <export_worker>

Number of workers for the export phase.

--export-batch-size <export_batch_size>

Batch size for the export phase.

--import-worker <import_worker>

Number of workers for the import phase.

--import-batch-size <import_batch_size>

Batch size for the import phase.

module

Commands for managing Odoo modules.

odoo-data-flow module [OPTIONS] COMMAND [ARGS]...
install

Installs or upgrades a list of Odoo modules.

odoo-data-flow module install [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

-m, --modules <modules_str>

Required A comma-separated list of module names to install or upgrade.

install-languages

Installs one or more languages in the Odoo database.

odoo-data-flow module install-languages [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

-l, --languages <languages_str>

Required A comma-separated list of language codes to install (e.g., ‘nl_BE,fr_FR’).

uninstall

Uninstalls a list of Odoo modules.

odoo-data-flow module uninstall [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

-m, --modules <modules_str>

Required A comma-separated list of module names to uninstall.

update-list

Scans the addons path and updates the list of available modules.

odoo-data-flow module update-list [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

path-to-image

Converts columns with local file paths into base64 strings.

odoo-data-flow path-to-image [OPTIONS] FILE

Options

-f, --fields <fields>

Required Comma-separated list of fields to export. Special specifiers are available for IDs: ‘.id’ for the raw database ID of the record. ‘field/.id’ for the raw database ID of a related record. ‘id’ for the XML/External ID of the record. ‘field/id’ for the XML/External ID of a related record. Using ‘.id’ or ‘/.id’ will automatically enable a faster, raw export mode.

--path <path>

Image path prefix. Defaults to the current working directory.

--out <out>

Name of the resulting output file.

Arguments

FILE

Required argument

url-to-image

Downloads content from URLs in columns and converts to base64.

odoo-data-flow url-to-image [OPTIONS] FILE

Options

-f, --fields <fields>

Required Comma-separated list of fields with URLs to convert to base64.

--out <out>

Name of the resulting output file.

Arguments

FILE

Required argument

workflow

Run legacy or complex post-import processing workflows.

odoo-data-flow workflow [OPTIONS] COMMAND [ARGS]...
invoice-v9

Runs the legacy Odoo v9 invoice processing workflow.

odoo-data-flow workflow invoice-v9 [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

--action <actions>

Workflow action to run. Can be specified multiple times. Defaults to ‘all’.

Options:

tax | validate | pay | proforma | rename | all

--field <field>

Required The source field containing the legacy invoice status.

--status-map <status_map_str>

Required Dictionary string mapping Odoo states to legacy states. e.g., “{‘open’: [‘OP’]}”

--paid-date-field <paid_date_field>

Required The source field containing the payment date.

--payment-journal <payment_journal>

Required The database ID of the payment journal.

--max-connection <max_connection>

Number of parallel threads.

write

Runs the batch update (write) process.

odoo-data-flow write [OPTIONS]

Options

--connection-file <connection_file>

Required Path to the Odoo connection file.

--file <filename>

Required File with records to update.

--model <model>

Required Odoo model to write to.

--worker <worker>

Number of simultaneous connections.

--size <batch_size>

Number of records to process per batch.

--fail

Run in fail mode, retrying records from the _write_fail.csv file.

-s, --sep <separator>

CSV separator character.

--context <context>

Odoo context as a dictionary string.

--encoding <encoding>

Encoding of the data file.

Transformation Processor (lib.transform)

This module contains the main Processor class used for data transformation.

This module contains the core Processor class for transforming data.

class odoo_data_flow.lib.transform.Processor(mapping, source_filename=None, dataframe=None, connection=None, model=None, config_file=None, separator=';', preprocess=<function Processor.<lambda>>, schema_overrides=None, **kwargs)

Core class for reading, transforming, and preparing data for Odoo.

Parameters:
  • mapping (Mapping[str, Any])

  • source_filename (str | None)

  • dataframe (DataFrame | None)

  • connection (Any | None)

  • model (str | None)

  • config_file (str | None)

  • separator (str)

  • preprocess (Callable[[DataFrame], DataFrame])

  • schema_overrides (dict[str, DataType] | None)

  • kwargs (Any)

check(check_fun, message=None)

Runs a data quality check function against the loaded data.

Parameters:
  • check_fun (Callable[[...], bool]) – The checker function to execute.

  • message (str | None) – An optional custom error message to display on failure.

Returns:

True if the check passes, False otherwise.

Return type:

bool

split(split_fun)

Splits the processor’s data into multiple new Processor objects.

Parameters:

split_fun (Callable[[...], Any]) – A function that takes a row dictionary and index, and returns a key to group the row by.

Returns:

A dictionary where keys are the grouping keys and values are new Processor instances containing the grouped data.

Return type:

dict[Any, Processor]

get_o2o_mapping()

Generates a direct 1-to-1 mapping dictionary.

Return type:

dict[str, MapperRepr]

process(filename_out, params=None, t='list', null_values=None, m2m=False, m2m_columns=None, dry_run=False)

Processes the data using a mapping and prepares it for writing.

Parameters:
  • mapping – The mapping dictionary defining the transformation rules.

  • filename_out (str) – The path where the output CSV file will be saved.

  • params (dict[str, Any] | None) – A dictionary of parameters for the odoo-data-flow import command, used when generating the load script.

  • t (str) – The type of collection to return data in (‘list’ or ‘set’).

  • null_values (list[Any] | None) – A list of values to be treated as empty.

  • m2m (bool) – If True, activates special processing for many-to-many data.

  • m2m_columns (list[str] | None) – A list of column names to unpivot when m2m=True.

  • dry_run (bool) – If True, prints a sample of the output to the console instead of writing files.

Returns:

A Dataframe containing the header list and the transformed data.

Return type:

DataFrame

process_m2m(id_column, m2m_columns, filename_out, params=None, separator=',')

Processes many-to-many data by first unpivoting the source data.

This is a robust alternative to using the m2m=True flag. It unnests comma-separated values from the ‘m2m_columns’ into individual rows before processing.

Parameters:
  • id_column (str) – The column to use as the stable ID (e.g., ‘id’ or ‘ref’).

  • m2m_columns (list[str]) – A list of columns that contain the m2m values.

  • filename_out (str) – The path where the output CSV file will be saved.

  • params (dict[str, Any] | None) – A dictionary of parameters for the odoo-data-flow import command.

  • separator (str) – The separator for the values within the m2m columns.

Return type:

None

write_to_file(script_filename, fail=True, append=False, python_exe='python', path='')

Generates the .sh script for the import.

Parameters:
  • script_filename (str) – The path where the shell script will be saved.

  • fail (bool) – If True, includes a second command with the –fail flag.

  • append (bool) – If True, appends to the script file instead of overwriting.

  • python_exe (str) – The python executable to use in the script.

  • path (str) – The path to prepend to the odoo-data-flow command.

Return type:

None

join_file(filename, master_key, child_key, header_prefix='child', separator=';', schema_overrides=None, dry_run=False)

Joins data from a secondary file into the processor’s main data.

Parameters:
  • filename (str) – The path to the secondary file to join.

  • master_key (str) – The column name in the main data to join on.

  • child_key (str) – The column name in the secondary data to join on.

  • header_prefix (str) – A prefix to add to the headers from the child file.

  • separator (str) – The column separator for the child CSV file.

  • schema_overrides (dict[str, DataType] | None) – A dictionary to override Polars’ inferred data types for the joined file.

  • dry_run (bool) – If True, prints a sample of the joined data to the console without modifying the processor’s state.

Return type:

None

Mapper Functions (lib.mapper)

This module contains all the built-in mapper functions for data transformation.

This module contains a library of mapper functions.

Mappers are the core building blocks for data transformations. Each function in this module is a “mapper factory” - it is a function that you call to configure and return another function, which will then be executed by the Processor for each row of the source data.

odoo_data_flow.lib.mapper.binary(field, path_prefix='', skip=False)

Returns a mapper that converts a local file to a base64 string.

Parameters:
  • field (str) – The source column containing the path to the file.

  • path_prefix (str) – An optional prefix to prepend to the file path.

  • skip (bool) – If True, raises SkippingError if the file is not found.

Returns:

A mapper function that returns the base64 encoded string.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.binary_url_map(field, skip=False)

Deprecated url mapper.

Parameters:
  • field (str)

  • skip (bool)

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.binary_url_to_base64(field, skip_on_fail=False)

Returns a mapper that downloads a file from a URL and converts to base64.

Parameters:
  • field (str) – The source column containing the URL.

  • skip_on_fail (bool) – If True, raises SkippingError if the URL cannot be fetched.

Returns:

A mapper function that returns the base64 encoded string, an empty string, or None, depending on the failure mode.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.bool_val(field, true_values=None, false_values=None, default=False)

Returns a mapper that converts a field value to a boolean ‘1’ or ‘0’.

The logic is as follows:

  1. If true_values is provided, any value in that list is considered True.

  2. If false_values is provided, any value in that list is considered False.

  3. If the value is not in either list, the truthiness of the value itself is used, unless default is set.

  4. If no lists are provided, the truthiness of the value is used.

Parameters:
  • field (str) – The source column to check.

  • true_values (list[str] | None) – A list of strings that should be considered True.

  • false_values (list[str] | None) – A list of strings that should be considered False.

  • default (bool) – The default boolean value to return if no other condition is met.

Returns:

A mapper function that returns “1” or “0”.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.concat(separator, *fields, skip=False)

Returns a mapper that joins values from multiple fields or static strings.

Parameters:
  • separator (str) – The string to place between each value.

  • *fields (Any) – A variable number of source column names or static strings.

  • skip (bool) – If True, raises SkippingError if the final result is empty.

Returns:

A mapper function that returns the concatenated string.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.concat_field_value_m2m(separator, *fields)

(Legacy V9-V12) Specialized concat for attribute value IDs.

Joins each field name with its value (e.g., ‘Color’ + ‘Blue’ -> ‘Color_Blue’), then joins all resulting parts with a comma. This was used to create unique external IDs for product.attribute.value records.

Parameters:
  • separator (str) – The character to join the field name and value with.

  • *fields (str) – The attribute columns to process.

Returns:

A mapper function that returns the concatenated string.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.concat_mapper_all(separator, *fields)

Returns a mapper that joins values, but only if all values exist.

If any of the values from the specified fields is empty, this mapper returns an empty string.

Parameters:
  • separator (str) – The string to place between each value.

  • *fields (Any) – A variable number of source column names or static strings.

Returns:

A mapper function that returns the concatenated string or an empty string.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.cond(field, true_mapper, false_mapper)

Returns a mapper that applies one of two mappers based on a condition.

Parameters:
  • field (str) – The source column to check for a truthy value.

  • true_mapper (Any) – The mapper to apply if the value in field is truthy.

  • false_mapper (Any) – The mapper to apply if the value in field is falsy.

Returns:

A mapper function that returns the result of the chosen mapper.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.const(value)

Returns a mapper that always provides a constant value.

Parameters:

value (Any)

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.field(col)

Returns the column name itself if the column has a value.

This is useful for some dynamic product attribute mappings.

Parameters:

col (str) – The name of the column to check.

Returns:

A mapper function that returns the column name or an empty string.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.m2m(prefix, *fields, sep=',', default='')

Returns a mapper that creates a comma-separated list of Many2many external IDs.

It processes values from specified source columns, splitting them by ‘sep’ if they contain the separator, and applies the prefix to each resulting ID.

Parameters:
  • prefix (str) – The XML ID prefix to apply to each value.

  • *fields (Any) – One or more source column names from which to get values.

  • sep (str) – The separator to use when splitting values within a single field.

  • default (str) – The value to return if no IDs are generated.

Returns:

A mapper function that returns a comma-separated string of external IDs.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.m2m_attribute_value(prefix, *fields)

(Legacy V9-V12) Creates a list of external IDs for attribute values.

This is a composite mapper for the legacy product attribute workflow.

Parameters:
  • prefix (str) – The XML ID prefix.

  • *fields (str) – The attribute columns to process.

Returns:

A mapper that returns a comma-separated string of external IDs.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.m2m_id_list(prefix, *args, sep=',', const_values=None)

Returns a mapper for creating a list of M2M external IDs.

This function can take either raw field names (str) or other mapper functions as its arguments. It processes each argument to produce an individual ID. If a field’s value contains the separator, it will be split.

Parameters:
  • prefix (str)

  • args (Any)

  • sep (str)

  • const_values (list[str] | None)

Return type:

Callable[[dict[str, Any], dict[str, Any]], list[str]]

odoo_data_flow.lib.mapper.m2m_map(prefix, mapper_func)

Returns a mapper that wraps another mapper for Many2many fields.

It takes the comma-separated string result of another mapper and applies the to_m2m formatting to it.

Parameters:
  • prefix (str) – The XML ID prefix to apply.

  • mapper_func (Callable[[dict[str, Any], dict[str, Any]], Any]) – The inner mapper function to execute first.

Returns:

A mapper function that returns a formatted m2m external ID list.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.m2m_template_attribute_value(prefix, *fields)

(Modern V13+) Creates a comma-separated list of attribute values.

This mapper concatenates the values of the given fields. This is used for the modern product attribute system where Odoo automatically creates the product.attribute.value records from the raw value names.

It will return an empty string if the template_id is missing from the source line, preventing the creation of orphaned attribute lines.

Parameters:
  • prefix (str) – (Unused) Kept for backward compatibility.

  • *fields (Any) – The attribute columns (e.g. ‘Color’, ‘Size’) to get values from.

Returns:

A mapper that returns a comma-separated string of attribute values.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.m2m_value_list(*args, sep=',', const_values=None)

Returns a mapper that creates a Python list of unique raw values.

It processes each argument to produce an individual raw value. If a field’s value contains the separator, it will be split.

Parameters:
  • args (Any)

  • sep (str)

  • const_values (list[str] | None)

Return type:

Callable[[dict[str, Any], dict[str, Any]], list[str]]

odoo_data_flow.lib.mapper.m2o(prefix, field, default='', skip=False)

Returns a mapper that creates a Many2one external ID from a field’s value.

Parameters:
  • prefix (str) – The XML ID prefix (e.g., ‘my_module’).

  • field (str) – The source column containing the value for the ID.

  • default (str) – The value to return if the source value is empty.

  • skip (bool) – If True, raises SkippingError if the source value is empty.

Returns:

A mapper function that returns the formatted external ID.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.m2o_att(prefix, att_list)

(Legacy V9-V12) Returns a dictionary of attribute-to-ID mappings.

This is a helper for legacy product attribute workflows where IDs for attribute values were manually constructed.

Parameters:
  • prefix (str) – The XML ID prefix to use for the attribute value IDs.

  • att_list (list[str]) – A list of attribute column names to process.

Returns:

A mapper function that returns a dictionary.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.m2o_att_name(prefix, att_list)

Returns a mapper that creates a dictionary of attribute-to-ID mappings.

This is used in legacy product import workflows.

Parameters:
  • prefix (str) – The XML ID prefix to use for the attribute IDs.

  • att_list (list[str]) – A list of attribute column names to check for.

Returns:

A mapper function that returns a dictionary.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.m2o_map(prefix, *fields, default='', skip=False)

Returns a mapper that creates a Many2one external ID by concatenating fields.

This is useful when the unique identifier for a record is spread across multiple columns.

Parameters:
  • prefix (str) – The XML ID prefix (e.g., ‘my_module’).

  • *fields (Any) – A variable number of source column names or static strings to join.

  • default (str) – The value to return if the final concatenated value is empty.

  • skip (bool) – If True, raises SkippingError if the final result is empty.

Returns:

A mapper function that returns the formatted external ID.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.map_val(mapping_dict, key_mapper, default='', m2m=False)

Returns a mapper that translates a value using a provided dictionary.

Parameters:
  • mapping_dict (dict[Any, Any]) – The dictionary to use as a translation table.

  • key_mapper (Any) – A mapper that provides the key to look up.

  • default (Any) – A default value to return if the key is not found.

  • m2m (bool) – If True, splits the key by commas and translates each part.

Returns:

A mapper function that returns the translated value.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.num(field, default=None)

Creates a mapper that converts a value to a native integer or float.

This function is a factory that generates a mapper function. The returned mapper attempts to robustly parse a value from a source dictionary key into a numeric type. It handles values that are already numbers, numeric strings (with or without commas), or empty/null.

Parameters:
  • field (str) – The key or column name to retrieve the value from in a source dictionary.

  • default (Any, optional) – The value to return if the source value is empty, null, or cannot be converted to a number. Defaults to None.

Returns:

A mapper function that takes a

dictionary-like row and returns the converted numeric value (int or float) or the default.

Return type:

Callable[…, Optional[Union[int, float]]]

odoo_data_flow.lib.mapper.record(mapping)

Returns a mapper that processes a sub-mapping for a related record.

Used for creating one-to-many records (e.g., sales order lines).

Parameters:

mapping (dict[str, Callable[[dict[str, Any], dict[str, Any]], Any]]) – A mapping dictionary for the related record.

Returns:

A mapper function that returns a dictionary of the processed sub-record.

Return type:

MapperFunc

odoo_data_flow.lib.mapper.split_file_number(file_nb)

Returns a function to split data across a fixed number of chunks.

Parameters:

file_nb (int) – The total number of chunks to create.

Returns:

A function compatible with the Processor.split method.

Return type:

Callable[[dict[str, Any], int], int]

odoo_data_flow.lib.mapper.split_line_number(line_nb)

Returns a function to split data into chunks of a specific line count.

Parameters:

line_nb (int) – The number of lines per chunk.

Returns:

A function compatible with the Processor.split method.

Return type:

Callable[[dict[str, Any], int], int]

odoo_data_flow.lib.mapper.to_m2m(prefix, value)

Creates a comma-separated list of external IDs .

Creates a comma-separated list of external IDs for a Many2many relationship. It takes a string of comma-separated values, sanitizes each one, and prepends the prefix.

Parameters:
  • prefix (str) – The XML ID prefix to apply to each value.

  • value (str) – A single string containing one or more values,

  • commas. (separated by)

Returns:

A comma-separated string of formatted external IDs.

Return type:

str

odoo_data_flow.lib.mapper.to_m2o(prefix, value, default='')

Creates a full external ID for a Many2one relationship.

Creates a full external ID for a Many2one relationship by combining a prefix and a sanitized value.

Parameters:
  • prefix (str) – The XML ID prefix (e.g., ‘my_module’).

  • value (Any) – The value to be sanitized and appended to the prefix.

  • default (str) – The value to return if the input value is empty.

Returns:

The formatted external ID (e.g., ‘my_module.sanitized_value’).

Return type:

str

odoo_data_flow.lib.mapper.val(field, default=None, postprocess=<function <lambda>>, skip=False)

Returns a mapper that gets a value from a specific field in the row.

Parameters:
  • field (str)

  • default (Any)

  • postprocess (Callable[[...], Any])

  • skip (bool)

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

odoo_data_flow.lib.mapper.val_att(att_list)

(Legacy V9-V12) Returns a dictionary of attributes that have a value.

This is a helper for legacy product attribute workflows.

Parameters:

att_list (list[str]) – A list of attribute column names to check.

Returns:

A mapper function that returns a dictionary.

Return type:

Callable[[dict[str, Any], dict[str, Any]], Any]

High-Level Runners

These modules contain the high-level functions that are called by the CLI commands.

Importer (importer)

Main importer module.

This module contains the high-level logic for orchestrating the import process. It handles file I/O, pre-flight checks, and the delegation of the core import tasks to the multi-threaded import_threaded module.

odoo_data_flow.importer.run_import(config, filename, model, deferred_fields, unique_id_field, no_preflight_checks, headless, worker, batch_size, skip, fail, separator, ignore, context, encoding, o2m, groupby)

Main entry point for the import command, handling all orchestration.

Parameters:
  • config (str | dict[str, Any])

  • filename (str)

  • model (str | None)

  • deferred_fields (list[str] | None)

  • unique_id_field (str | None)

  • no_preflight_checks (bool)

  • headless (bool)

  • worker (int)

  • batch_size (int)

  • skip (int)

  • fail (bool)

  • separator (str)

  • ignore (list[str] | None)

  • context (Any)

  • encoding (str)

  • o2m (bool)

  • groupby (list[str] | None)

Return type:

None

Exporter (exporter)

This module contains the high-level logic for exporting data from Odoo.

odoo_data_flow.exporter.run_export(config, model, fields, output, domain='[]', worker=1, batch_size=1000, context='{}', separator=';', encoding='utf-8', technical_names=False, streaming=False, resume_session=None)

Orchestrates the data export process.

Parameters:
  • config (str | dict[str, Any])

  • model (str)

  • fields (str)

  • output (str)

  • domain (str)

  • worker (int)

  • batch_size (int)

  • context (str)

  • separator (str)

  • encoding (str)

  • technical_names (bool)

  • streaming (bool)

  • resume_session (str | None)

Return type:

None

Migrator (migrator)

Migrate data between two odoo databases.

This module contains the logic for performing a direct, in-memory migration of data from one Odoo instance to another.

odoo_data_flow.migrator.run_migration(config_export, config_import, model, domain='[]', fields=None, mapping=None, export_worker=1, export_batch_size=100, import_worker=1, import_batch_size=10)

Performs a server-to-server data migration.

This function chains together the export, transform, and import processes without creating intermediate files.

Parameters:
  • config_export (str)

  • config_import (str)

  • model (str)

  • domain (str)

  • fields (list[str] | None)

  • mapping (Mapping[str, Callable[[...], Any]] | None)

  • export_worker (int)

  • export_batch_size (int)

  • import_worker (int)

  • import_batch_size (int)

Return type:

None