Use
USE
changes the target table for a transformation from the unified dataset to another set of data, such as another dataset or a data label.
USE
statements are most commonly used to apply a small transformation to a reference dataset before a JOIN
or UNION ALL
.
USE Syntax
USE "my_dataset_name.csv";
Note: Because the target of USE
and the columns of the unified dataset are likely to be very different, preview cannot be used reliably while in the context of the target dataset.
USE Example
You want to join the unified dataset of a Tamr project with a reference dataset named exchange_rates.csv. However, while exchange_rates.csv includes exchange rates for many different currencies, you only want to join with records that have "USD" (US Dollars) as the target currency.
To apply a FILTER
statement to the exchange_rates.csv reference dataset before you JOIN
it with the unified dataset, you insert a USE
statement as follows.
// Create a label that saves the current state of the unified dataset
pre_currency_lookup: SELECT *;
// Create a label for the final state of the lookup table
// Using { (scope) starts a group of transformations
// that will define this label
exchange_data: {
// Use a reference dataset
USE "exchange_rates.csv";
// Filter the reference dataset
FILTER target_currency == 'USD';
// Using } ends the scope of transformations that should be labeled as "exchange_data"
};
// Return to the unified dataset, by using the label
// created in line 2
USE pre_currency_lookup;
// Join with the exchange_data label
JOIN WITH exchange_data ON currency == exchange_data.source_currency;
Updated over 2 years ago