Updating Legacy Models

Last updated on Jun 05, 2023

If your Models have the LEGACY tag next to the Model name in the Model Overview page, and were created prior to Release 1.44, then this information is relevant for you.

LEGACY Tag for older Models

You can update your existing Models to use the new features, such as, templatized queries, automated creation of output tables, and the ability to reset the Model. Read Key Features. Updating to the new Models essentially means creating a new Model with the same or modified SQL query and selecting or creating the output table again. You need to modify the SQL query in the Model only if you want to include templated methods.

Note: You must be assigned the Team Administrator, Team Collaborator, Models and Workflows Administrator, or Models and Workflows Collaborator role in Hevo, to update Legacy Models in Hevo.

For instance, the query

select id, name, dept_name
  from employees
  where updated_ts > (current time - offset hours)

can be changed to

select id, name, dept_name
  from employees
  where ${GTE_RECORD_SEQUENCE_TS(employees, __hevo__record_sequence_ts)}

The __hevo__record_sequence_ts field serves as a timestamp and makes sure that each Model run picks up only the changed or new records since the last run (approximately).

Note: This is possible only for Destination tables that are created in Hevo.


Truncate and Load Models

Models created in earlier versions with the Truncate and load option enabled are updated as non-incremental Models. Primary keys are not required to be entered during this type of update, as the table is recreated on every Model run.

To migrate your Model in this mode, the Incremental Model option must be disabled.


Incremental Models

Legacy Models with the Truncate and load option disabled need to be migrated as incremental Models with the required primary keys (optional), using which, the records are deduplicated.

You may use the primary keys from the output table of the Model if you want the deduplication to function exactly as the existing Model.

Tell us what went wrong