Partial Copy of View Data | Teradata Data Mover - 17.10 - About Partial Copying of View Data - Teradata Data Mover

Teradata® Data Mover User Guide

Product
Teradata Data Mover
Release Number
17.10
Release Date
June 2021
Content Type
User Guide
Publication ID
B035-4101-061K
Language
English (United States)

Partial data copy can be performed from a source view to a target table or view by specifying a WHERE clause and key columns. This is very similar to partial copy of data tables.

The following example shows a partial data copy from a source view:
<views>
	<view selection="included" copyData="true">
		<name>deptsals</name>
		<database>MyDb</database>
		<view_data_table>
			<target_table>TargetTable</target_table>
			<target_database>TargetDb</target_database>
		</view_data_table>

		<staging_database>
			<name>TargetDb_Staging</name>
		</staging_database>

		<compare_ddl>true</compare_ddl>

		<sql_where_clause><![CDATA[  WHERE "deptsals"."employee_number" = 1]]></sql_where_clause>
		<key_columns>
			<key_column>employee_number</key_column>
		</key_columns>
	</view>
</views>

In the example above, a SELECT statement with a WHERE clause is used to select data from the view where "employee_number" = 1 and load the partial data to the target table. Key columns must be specified when a SQL WHERE clause is specified.

A view definition or data from a view can be copied without copying the tables associated with the view.

When performing a partial copy of view data to a target view, the qualifying rows are first copied to a staging table. After the rows are copied to the staging table, the qualifying records in the WHERE clause are copied from the staging table to the target view. This process is similar to a partial table copy when the target table exists with data.