Version:

Input Var

Learn how to create and use input_var in your Profiles project.

An input_var adds a calculated column to an input table. It calculates a single value per row of the input table which can be used as an input for entity_vars.

warning

Performance consideration: Input vars scan all input data on every run, which can be expensive for large datasets.

Consider using the following approaches for better performance:

Use input_var only when you need row-level calculations on the input table before entity-level aggregation (for example, window functions like ROW_NUMBER() or LAG()).

- input_var:
    name: input_var_name
    select: SQL statement
    from: inputs/table
    window:
        partition_by:
            - partition_column
    description: description
FieldDescription
nameName of the input_var.
selectSQL state, equivalent to SELECT statement.
fromPath of the input table, equivalent to FROM statement.
whereFiltering condition, equivalent to WHERE statement.
windowAdds partition_by and/or order_by keys for window functions
descriptionDescription of the input_var.

Example

- input_var:
    name: page_count
    description: Adds column to a SQL model to get a page count per date.
    select: count(distinct url)
    from: models/pages_orderby_table
    window:
        partition_by:
            - profile_id
            - date

Questions? Contact us by Email or on Slack