You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the `importing_data.md` guide to reflect the new functionality
for handling data migrations between separate source and destination
databases.
The documentation now explains: - The new optional `config_file`
parameter in the `Processor` constructor, which is used for reading
metadata from a source database. - The new `'config'` key in the
`params` dictionary of the `process()` method, which is used to specify
the destination database for the generated import script. - A new "Full
Example for a Data Migration" section has been added to clearly
demonstrate the recommended workflow.
This ensures that users can correctly leverage the new migration-aware
features of the library.
Copy file name to clipboardExpand all lines: docs/guides/importing_data.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,6 +139,7 @@ processor = Processor(
139
139
The constructor takes the following arguments:
140
140
141
141
***`filename` (str)**: The path to the CSV or XML file you want to transform.
142
+
***`config_file` (str, optional)**: Path to the Odoo connection configuration file. This is used for operations that need to read metadata from the source database (e.g., when using `--verify-fields`).
142
143
***`separator` (str, optional)**: The column separator for CSV files. Defaults to `;`.
143
144
***`preprocess` (function, optional)**: A function to modify the raw data _before_ mapping begins. See the [Data Transformations Guide](./data_transformations.md) for details.
144
145
***`xml_root_tag` (str, optional)**: Required argument for processing XML files. See the [Advanced usage Guide](./advanced_usage.md) for details.
@@ -199,6 +200,7 @@ The `params` dictionary allows you to control the behavior of the import client
|`config`|`--config`|**For Migrations**. Path to the destination config file. Overrides the `config_file` from the Processor for the final import script. |
202
204
|`model`|`--model`|**Optional**. The technical name of the Odoo model (e.g., `sale.order`). If you omit this, the tool infers it from the filename. |
203
205
|`context`|`--context`| An Odoo context dictionary string. Essential for disabling mail threads, etc. (e.g., `"{'tracking_disable': True}"`) |
204
206
|`worker`|`--worker`| The number of parallel processes to use for the import. |
This method takes a single argument: the path where the `load.sh` script should be saved. It automatically uses the `filename_out` and `params` you provided to the `process()` method to construct the correct commands.
218
220
219
-
## Full Example
221
+
## Full Example for a Data Migration
220
222
221
223
Here is a complete `transform.py` script that ties everything together.
222
224
223
225
```{code-block} python
224
226
:caption: transform.py
225
227
from odoo_data_flow.lib.transform import Processor
226
228
from odoo_data_flow.lib import mapper
229
+
from files import * # Imports source_config_file and destination_config_file
227
230
228
231
# 1. Define the mapping rules
229
232
sales_order_mapping = {
@@ -234,15 +237,21 @@ sales_order_mapping = {
234
237
}
235
238
236
239
# 2. Define the parameters for the load script
240
+
# Note that we specify the destination config file here.
0 commit comments