Before You Begin
This 15-minute tutorial shows you how to transform data while you load it into a database using Oracle Analytics Cloud Data Sync. You transform data during loading if the data isn't in the format you want. For example, you might add a default value to empty fields, or covert mixed-case values to upper case for consistency.
Background
Using Oracle Analytics Cloud Data Sync, you can transform and load data into a database so that you can then analyze the data in Oracle Analytics Cloud.
What Do You Need?
- Oracle Analytics Cloud Data Sync version 2.5
- Java Development Kit (JDK) V1.8
- Access to an Oracle Database Cloud Service instance, including:
- user name
- password
- URL
- Java Database Connectivity (JDBC) driver
- Download sampledatadenorm.csv.
Create
Your Data Loading Project
In Oracle Analytics Cloud Data Sync, create a new project to manage your data load.
- From the directory where you installed Oracle Analytics Cloud Data Sync, run
datasync.batordatasync.sh. - In Enter Password, enter your password, click Remember password, and then click Login.
- In the Welcome dialog box, click Create a New Project, enter
Data Transform Demo,and then click OK.
Create
Your Target Connection
Specify the connection details for your target database.
- Click Connections, and then click New.
- In the New Connection dialog box, click Name, and enter
OracleDB. - In the Type field, select Oracle (Thin), and then click OK.
- Click the Edit tab.
- In User, enter the user name of your database account.
- In Password, enter the password of your database account.
- In URL, click the edit icon
, enter the URL for your Oracle
Database Cloud Service instance and then click OK. For example, jdbc:oracle:thin:@HOST_NAME:1521/SERVICE_NAME. - In JDBC Driver, click the edit icon
, and enter the JDBC driver address
for your Oracle Database Cloud Service instance, and then click OK. For example, oracle.jdbc.driver.OracleDriver.) - Click Test Connection, and then click OK.
- Click Save.
Configure
Your Data Load
Choose which columns and rows to load, and what to name the target table.
- Click Project, click Source Data, and then click Data From Object(s).
- In the Select Source dialog box, click File source, and then click OK.
- In the Select File dialog box, in the File Location field, click the edit icon
. - In the Open dialog box, navigate to and select the
sampledatadenorm.csvfile, and then click Next. - In the Import Options dialog box, click Next.
- In the Configure Target dialog box, in the
Create new field, enter
T_PRODUCTS, and then click Next. - In the New Source File: Map Columns dialog box, click Select None.
- In the Load column, select the
product-related columns:
- CHANNEL_NAME
- PROD_ITEM_KEY
- PROD_BRAND
- PROD_LOB
- PROD_TYPE
- PRODUCT
- PROD__ITEM_DESC
- In the PROD_ITEM_KEY row, click Update Rows on Match, and then click OK.
- Click Source Data, and in the Data from Object(s) tab, click the Targets tab.
- In the Load Strategy column, click the edit icon
, and then click Replace data in table. - Click OK.
Configure Your Data Transformations
Apply these data transformations:
- Convert CHANNEL_NAME values (for example, 'Online' and 'online') to uppercase to make the channel names consistent.
- Insert the default value LOB_01 for the empty PROD_LOB field to make identification easier.
- Concatenate the PROD_TYPE and PRODUCT fields to make the product names easier to read.
- In the Targets tab, click Map Columns to display the Map Columns: File source dialog box.
- In the CHANNEL_NAME row, click the edit icon
in the Target Expression column,
enter UPPER("%%T_PRODUCTS"."CHANNEL_NAME" ),and then click OK. - In the PROD_LOB row, click the edit icon
in the Target Expression column,
enter LOB_01in the Default field, and then click OK. - In the PROD_TYPE row, click the edit icon
in the Target Expression column,
enter "%%T_PRODUCTS"."PROD_TYPE" || "%%T_PRODUCTS"."PRODUCT",and then click OK. - Close the Map Columns dialog box.
Load
and Transform Your Data
Create and run a data loading job to load and transform your data.
- Click Jobs, and then click New.
- In the New Job dialog box, enter
MyProductsin Job name, and then click Next. - In New Job, in the TARGET row, click Override With, and select OracleDB. Click Finish.
- In Configuring execution instance, click OK.
- Click Run Job. In Do you want to run the job "Data Transform Demo - MyProducts," click OK.
- In Run Job, Request successfully submitted, click OK.
Check
Your Data Transformations
Monitor the data loading job to check that the data load was successful.
- In the Jobs tab, click Runs.
- Review the Run Status column until you see the value Completed.
- Click Tasks, and make sure that the Successful Rows value is
5248and the Failed Rows value is0.
Transforming
Data Using Oracle Analytics Cloud Data Sync