HomeDocsAPI Reference
Kumo.ai
Docs

FOR EACH

FOR EACH <entity_table>.<primary_entity_key> (Required)

Description

After specifying the prediction target, pQueries are completed when you include the next required component, the FOR EACH clause to specify the entity you want to make predictions for.

Please note that only a primary key column of a dimension table can be selected for this field.

Example

The syntax (and some examples) for this part of the query is as follows:

FOR EACH <entity_table>.<primary_entity_key>
FOR EACH USERS.user_id
FOR EACH STORES.store_id

If you don't have a proper dimension table with unique rows, you can use the SELECT DISTINCT SQL command to create a new view or table from your original entity table with non-unique rows, or all of your raw fact tables. Using SELECT DISTINCTwill result in a new view or table with a single column containing unique IDs.

🚧

Your entity table must be directly connected to your target table via a primary key to foreign key relationship.