Write custom scripts for batch data transforms in a standard Python environment by using your preferred IDE and validate them locally against a sandbox.
To write custom scripts and validate them locally against a sandbox:
Permission set:
Data Cloud Architect
Prerequisites
Set up your Data 360 environment.
Verify that you have access to a Data 360 sandbox with appropriate permission sets. If you don’t have a sandbox, create one. See Create a Data 360 Sandbox.
To add new dependencies during development, always add them to requirements.txt and then install by using this command. This process ensures that all dependencies are included in your deployment package.
Note
Write your script in payload/entrypoint.py to reference the ingested data.
Test your script.
1sf data-code-extension script run --entrypoint<path_to_entrypoint>--target-org<org_alias>
--entrypoint <path_to_entrypoint> (required): Path to your script entry point (typically ./payload/entrypoint.py in the default package layout).
--target-org <org_alias> (required): The alias against which you’re testing your script.
Example:
1sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org myorg
Optionally, control the number of rows returned during local testing.
By default, Data 360 queries return 1,000 rows when you test locally. To validate against a larger dataset, raise the row limit. To iterate faster on a smaller sample, lower it. Set the row limit in entrypoint.py before your script reads any data.
Import config in your entrypoint.py.
1from datacustomcode.config import config
Set the row limit to the number of rows you need. For example, to return 5,000 rows:
If you package and upload your entrypoint with this setting, the package includes the row limit, which then applies when run in Data 360. Remove or reset the row limit before packaging for deployment.
Important
Update the Data 360 configuration file after changing your script.
The sf data-code-extension script scan command doesn’t work as intended for DMO-to-DMO transforms. You must manually craft the config.json file. See Configure config.json for DMO-to-DMO Transforms.