Query Export Options

While creating a Model, you have the option to export the query results into an Output table. You can do one of the following:

  • Select an existing table

    Table creation options for query export

    The Model expects that the schema of the selected output table matches the destination table schema. You can add appropriate aliases in the query to make it compatible with the existing output table fields.

    For instance, if the query in the Model is:

    select id, name, dept from employees
    

    and these fields are mapped to emp_id, emp_name, emp_dept in the output table, then you need to change the query to ensure that the output table schema remains the same the next time the Model runs.

    select id as emp_id, name as emp_name, dept as emp_dept from employees
    
  • Create a new table

    If you choose to create a new table, you can provide just the table name and a list of primary keys, and Hevo automatically creates the output table with the required columns.

    For example, if you create a Model with the following SQL query:

    select emp_no, birth_date, first_name, last_name from demo_employees
    

    and provide the name for the new output table, Hevo automatically creates the output table with the required structure to store the query results.

    Automated table creation

Note: If you are using Legacy Models, you can switch over to the new Models to consume the latest features. See section Updating Legacy Models for more information.