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
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_deptin 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.