The Script option is a flexible tool for defining transformations in Tamr. Scripts have a text-based, statement-oriented syntax.
While the Formula option limits you to a single type of statement,
SELECT *, you can use scripts to run any of the statements that Tamr supports.
The following example shows a simple script in the transformation editor:
Color-coding the components of a simple script in the transformation editor.
The transformation editor uses color-coding to help you parse a script more easily:
- Statement names appear in pink font
- Function names appear in blue font
- Attribute (also referred to as column) names appear in green font
- Punctuation and other syntax characters appear in black font
These suggestions can help make your scripts easier to read and collaborate on.
- Begin every script with a brief comment that describes the goal of the script. To indicate a comment, start the line with
- When you define your unified dataset, use a consistent format for attribute names. For example, always use "camelCase" or "snake_case". In the transformation editor, attribute names are case sensitive.
SELECTstatements, include a line break after each
- When writing nested transformations, consider using multiple spaces to indent and visually divide the script into sections.
- The syntax for Tamr transformations (other than attribute names) is case insensitive; however, Tamr recommends writing statement names in all uppercase and function names in all lowercase as a best practice. Following this practice can make it easier to disambiguate the FILTER statement from the filter() function, for example.
These suggestions can help you use the Tamr transformation editor more effectively.
- To view long scripts, expand the script box to open a larger editing area. To go back to the original area, choose Collapse.
- To comment or uncomment lines of code, use Cmd+/ (Mac) or Ctrl+/ (Windows).
- Multi-line comments can be written using
/* My long comment */
- To view an attribute's data type, move your mouse cursor over the attribute name.
- To view a function's signature, move your mouse cursor over the function name.
- To learn how to use a function, Cmd+click (Mac) or Ctrl+click (Windows) on the function name to open a description in a new browser tab.
Updated 3 months ago
|Example Tasks for Transformation Scripts|
|Working with Statements|
|Working with Expressions|