HomeTamr Core GuidesTamr Core API Reference
Tamr Core GuidesTamr Core API ReferenceTamr Core TutorialsEnrichment API ReferenceSupport Help CenterLog In

Select

SELECT renames attributes and creates new ones based on expressions.

The syntax for SELECT is:

`SELECT <code> AS attribute, ...`

Where <code> could be an attribute or an expression.

The most important use case for SELECT is

SELECT *;.

The * represents all attributes that are not otherwise referenced in the SELECT statement. It is useful to start almost all of your scripts with SELECT *, .... Formulas automatically include a SELECT * and you do not have to remember to write it yourself.

Using SELECT to Rename Attributes

This is the simplest form of SELECT:

SELECT *, attribute1 AS attribute2;.

The table that results from this statement has the values that were previously in attribute1 in attribute2. You can rename as many attributes as you want. For example:

SELECT *, attribute1 AS attribute2, attribute3 AS attribute4;

Adding Attributes to a Unified Dataset

To see an attribute in your unified dataset, you must choose Create attribute on the Schema Mapping page. If you do not do this, then the attribute does not appear in on the Unified Dataset page. You can still reference the attribute in your scripts, but it does not appear in preview or in export.

Generating Attributes Based on Expressions with SELECT

You can write expressions with SELECT to manipulate the values in attributes. For example, you could multiply the Product_Price by a conversion factor to change currencies:

SELECT *, 
(Product_Price * conversion_factor) AS Product_Price;

You could also choose to have both currencies in your table in separate columns.

(Product_US_Price * conversion_factor) AS Product_EU_Price;

Note: Do not forget to Include SELECT *. If you do not write SELECT * at the beginning of these scripts, the table from these transformations will only have the attributes Product_EU_Price, or Product_EU_Price and Product_US_Price, respectively.


Did this page help you?