Snowflake Data Cloud Connector > Part II: Data Integration with Snowflake Data Cloud Connector > Mappings for Snowflake Data Cloud > Mapping example
  

Mapping example

An enterprise application uses the Oracle database to store product transaction details. You want to check the availability of stocks based on completed and pending transactions from the source data. You want to integrate the available stocks and transaction details to Snowflake for further analysis.
Mapping
The following image shows the Snowflake Data Cloud mapping for this use case:
You create a mapping to read the product transaction details from an Oracle source and apply a lookup condition on the PRODUCTDET table in Snowflake which stores details of product and its availability. Based on the availability and requirement, you write the transactions to the PENDINGTRANSACTION and COMPLETEDTRANSACTION tables in Snowflake and update the INSTOCK field in the PRODUCTDET table for the completed transactions.
You use the following transformations in the Snowflake Data Cloud mapping:
Source transformation
To read the product transaction details from an Oracle source, include an Oracle connection in the Source transformation to connect to Oracle. The source object for the mapping task is an OracleSrc table from Oracle.
The following image shows the transaction details stored in the OracleSrc table that you want to read:
Lookup transformation
The lookup object for the mapping task is PRODUCTDET table in Snowflake, which has details of the product and its availability. Apply the lookup condition on the PRODUCTDET table in Snowflake which stores details of product and its availability based on the product ID.
The following image shows the data stored in the PRODUCTDET table:
Expression transformation
The Expression transformation uses an expression to calculate the stock availability.
Router transformation
The Router transformation filters data based on the availability of stocks and redirects completed transactions, pending transactions, and product details to the appropriate target tables.
Target transformation
The mapping task has the following target objects to write the completed transactions, pending transactions, and product details:
COMPLETEDTRANSACTION
The COMPLETEDTRANSACTION table includes the TRANSACTIONID, PRODUCTID, QUANTITY, ORDERPLACEDON, and ORDERCOMPLETEDON fields.
The following image shows the data stored in the COMPLETEDTRANSACTION table:
PENDINGTRANSACTION
The PENDINGTRANSACTION table includes the PRODUCTID, TRANSACTIONID, REQUIREDQUANTITY, and ORDERPLACEDON fields.
The following image shows the data stored in the PENDINGTRANSACTION table:
PRODUCTDET
The PRODUCTDET table includes the PRODUCTID, INSTOCK, PRODUCTDET, and PRICE fields. Based on the completed transactions, the INSTOCK field is updated.
The following image shows the data stored in the PRODUCTDET table:
When you run the mapping, the agent reads the transaction details from source, fetches fields from the lookup, and based on the conditions applied write the available quantity and transaction details to the target tables.