Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Virtualization Tutorial: Custom Functions

Similar presentations


Presentation on theme: "Data Virtualization Tutorial: Custom Functions"— Presentation transcript:

1 Data Virtualization Tutorial: Custom Functions
Hello, and welcome to the Tutorial Series for Cisco Information Server, or CIS. In this tutorial, we discuss Custom Functions.

2 For more details… Resources: Additional information: Archives
Documentation Training Resources: Archives Data files Tutorial Document Note that Tutorials are NOT meant to be comprehensive training modules. Instead, they demonstrate a very basic use case that can be built quickly and easily. However, the Data Virtualization Knowledge Base contains additional information that will help you learn more and go deeper. Additional resources in the Knowledge Base include: <CLICK> Resources used to build the tutorial, such as Data Virtualization Archive files, data source files, and a document version of this tutorial… <CLICK> … and additional information, including documentation and training materials.

3 Agenda What are they and why do they matter? How-to Summary
Here is our agenda. We begin by defining Custom Functions and outlining their importance in Data Virtualization projects. Next we demonstrate the basics of Custom Functions. Finally, we summarize the contents of this tutorial.

4 Agenda What are they and why do they matter? How-to Summary
Let’s begin by discussing what Custom Functions are, and why they are important for Data Virtualization.

5 What are they? Custom Functions User-Defined SQL construct
Accept parameters, return a single scalar output May be used in SELECT or WHERE clause Example: SELECT UPPER(MY_COL) AS UPPER_MY_COL CIS Custom functions created by “promoting” SQL Scripts or Custom Java Procedures SQL functions are programming constructs that accept one or more parameters and return a single scalar output. Functions may be used in SELECT or WHERE clauses. SQL Developers are familiar with standard SQL Functions such as the UPPER function shown in the example here. CIS developers can define custom functions that may be used in similar ways. CIS Developers can create custom functions from any SQL Script or Custom Java Procedure that returns a single scalar output.

6 Why do they matter? Custom Functions Standardize common tasks
Promote re-use Custom Functions are important to CIS Developers in many use cases. They are a convenient way to standardize common data transformation tasks, and they enable re-use across many projects.

7 Agenda What is it and why does it matter? How-to Summary
Next, let’s walk through a very basic demo of Custom Functions.

8 Here is the business problem…
First Name Last Name John Doe Jane Smith Tim Lee Rosterized Name DOE, JOHN SMITH, JANE LEE, TIM Here is the business problem that we illustrate in this tutorial. This enterprise has hundreds of database tables where people’s first and last names are stored in separate columns. <CLICK> They have many different use cases where names must be converted to the format shown here: Last Name, comma, space, First Name, all capitalized in a single column. We’ll call this the “rosterized” name for this demo, and we’ll create a custom function to make it easy for many different projects to perform this task.

9 Before you begin… We’ll create a SQL Script to do the work, and then promote it to a custom function. The SQL Script is trivial, and you can easily build it from scratch. However, the Knowledge Base also contains a Data Virtualization Archive File with this script. We assume you have a basic understanding of SQL Script; if not, please consult the Knowledge Base resources on this topic. <CLICK> We will use data from the CIS Examples folder, so you do not need to create any data source connections.

10 Compose the Script Now we’re ready to begin. Create a folder for your work. <CLICK> Right-click the folder and select New SQL Script. <CLICK> Name the script… <CLICK> … and a script skeleton appears in the editor.

11 Compose the Script Our script is very simple.
<CLICK> It accepts two input parameters: first name and last name. <CLICK> It translates the parameters to upper case and concatenates them, separating the last name from the first name with a comma and a space… <CLICK> … and returns the result.

12 Test the Script Execute the script…
<CLICK> … to verify that it is working properly.

13 Promote the Script to a Function
Since our script returns only a single scalar, we can promote it to a custom function. From the Studio Administration menu, select Custom Functions. <CLICK> A list of candidate functions appears. It consists of all procedures and scripts that return a single scalar. <CLICK> Those already promoted appear with a check mark. <CLICK> Search for the new script. <CLICK> Click the check mark, then click OK.

14 Use the Function in a View
Right-click your development folder and select New View. <CLICK> Name the view… <CLICK> … and drag in the Customers table from the ds_orders data source in the CIS Examples folder.

15 Use the Function in a View
Now we can use the Custom Function in our projection. Go to the Grid Panel, right-click the column area, and select Function, Custom. <CLICK> Select the new Function from the list.

16 Use the Function in a View
Now we can fill out the arguments for the function. <CLICK> For argument 1, choose the contactfirstname column. <CLICK> For argument 2, choose the contactlastname column.

17 Use the Function in a View
Name the column with an Alias. <CLICK> Verify that the SQL statement has been created on the SQL tab. Alternatively, I could have typed my statement here instead of using the Grid tab.

18 Use the Function in a View
Execute the View. Our function is working correctly. We have seen how to create a custom function from a SQL Script, and how to use it in a View. Our demo is complete.

19 Agenda What is it and why does it matter? How-to Summary
Let’s summarize what we have seen in this tutorial.

20 Summary: Definition Custom Functions User-Defined SQL construct
Accept parameters, return a single scalar output May be used in SELECT or WHERE clause Example: SELECT UPPER(MY_COL) AS UPPER_MY_COL CIS Custom functions created by “promoting” SQL Scripts or Custom Java Procedures SQL functions are programming constructs that accept one or more parameters and return a single scalar output. Functions may be used in SELECT or WHERE clauses. SQL Developers are familiar with standard SQL Functions such as the UPPER function shown in the example here. CIS developers can define custom functions that may be used in similar ways. CIS Developers can create custom functions from any SQL Script or Custom Java Procedure that returns a single scalar output.

21 Summary: Benefits Custom Functions Standardize common tasks
Promote re-use Custom Functions are important to CIS Developers in many use cases. They are a convenient way to standardize common data transformation tasks, and they enable re-use across many projects.

22 Summary: Key Take-aways
Custom Functions Encapsulate business functionality specific to your enterprise Enable re-use across many projects and many data sources Any script or procedure that outputs a single scalar can be promoted to a Custom Function. As you work with custom functions in CIS, keep these key takeaways in mind. Custom Functions let you encapsulate business functionality that is specific to your enterprise. This functionality can then be re-used across many projects, with data from many disparate sources. You can promote any script or Java procedure to a custom function, as long as it outputs only a single scalar value.

23 Summary: What’s next? Use your knowledge to encapsulate and re-use business functionality Leverage your knowledge to introspect Custom Functions on your physical data sources Learn to create Custom Java Procedures After completing this tutorial, you are ready to begin using Custom Functions in your Data Virtualization projects. Use your knowledge to encapsulate and re-use important business functionality. Leverage your knowledge to introspect and use custom functions on your physical data sources within CIS. Learn to create Custom Java Procedures that can be promoted to custom functions. Thank you.

24


Download ppt "Data Virtualization Tutorial: Custom Functions"

Similar presentations


Ads by Google