The transform component binds code to a dataset. Common uses for the transform component are:
- Fetching data from the web & editing it into structured data
- Automating data cleanup
- Running calculations on dataset values to produce new ones
- Combining 2 or more datasets
A transform script is executed when saving a new version. The script itself is embedded within the dataset creating both an audit trail & easy repeatability. Qri executes transforms in a sandbox, with no access to the local filesystem, and controlled internet access.
Qri transforms are written in Starlark, a programming language similar in syntax to Python3.
Transforms are currently view-only in Qri Desktop. Each dataset component has its own tab in Qri Desktop's sidebar. If a dataset version contains a transform, click the transform tab to view it.
If a dataset already has a transform component, use
qri get to inspect a dataset's transform, which will write the starlark code to the terminal.
$ qri get transform.script b5/world_bank_population
Likewise, you can commit changes to transform using
qri save and providing a
$ qri save --file transform.starusing dataset [me/my_dataset]dataset saved: foo/[email protected]/ipfs/QmXciFZ7CZj3PfauaXSpKd6amyUpWh4qiPhPGywFbzjhWa
See introduction for an introduction to starlark transforms.