Hive Mappings
Based on the mapping environment, you can read data from or write data to Hive.
In a native environment, you can read data from Hive. To read data from Hive, complete the following steps:
- 1. Create a Hive connection.
- 2. Configure the Hive connection mode to access Hive as a source or target.
- 3. Use the Hive connection to create a data object to read from Hive.
- 4. Add the data object to a mapping and configure the mapping to run in the native environment.
You can write to Hive in a Hadoop environment. To write data to Hive, complete the following steps:
- 1. Create a Hive connection.
- 2. Configure the Hive connection mode to access Hive as a source or target.
- 3. Use the Hive connection to create a data object to write to Hive.
- 4. Add the data object to a mapping and configure the mapping to run in the Hadoop environment.
You can define the following types of objects in a Hive mapping:
- •A Read Transformation to read data from Hive
- •Transformations
- •A target or an SQL data service. You can write to Hive if you run the mapping in a Hadoop cluster.
Validate and run the mapping. You can deploy the mapping and run it or add the mapping to a Mapping task in a workflow.
Hive Mapping Example
Your organization, HypoMarket Corporation, needs to analyze customer data. Create a mapping that reads all the customer records. Create an SQL data service to make a virtual database available for end users to query.
You can use the following objects in a Hive mapping:
- Hive input
The input file is a Hive table that contains the customer names and contact details.
Create a relational data object. Configure the Hive connection and specify the table that contains the customer data as a resource for the data object. Drag the data object into a mapping as a read data object.
- SQL Data Service output
Create an SQL data service in the Developer tool. To make it available to end users, include it in an application, and deploy the application to a Data Integration Service. When the application is running, connect to the SQL data service from a third-party client tool by supplying a connect string.
You can run SQL queries through the client tool to access the customer data.