99-02-FM-Defining a Data Source View - Via a Project Introduction Labs 99-02 and 99-03 are intended to introduce you to methods of developing data warehouses and cubes to an organization with business intelligence. Business intelligence (BI) is information that has been derived from the data that is already in your organization and from data in external sources. Business intelligence is designed to help you make better and faster decisions. A BI system should be able to capture data from many sources, transforming the data into a consistent and usable form and storing that data in a single location. From that single location the software should present the information for easy analysis and decision making. For this subject the source is a single location. The BI system can have up to five layers: A data source layer A data transformation layer A Data Storage and retrieval layer An analytical layer A presentation layer Objective: To design a data warehouse then import the data after. In the following task, you open Business Intelligence Development Studio and create a new Microsoft SQL Server Analysis Services (SSAS) project. The name used throughout these Labs may be different to how you name decide to name them. You can choose to name it something else as long as you remember what you called it. A project is a collection of related objects. Projects exist within a solution, which includes one or more projects. Tasks in this tutorial are Starting a New Analysis Services project Define a Data Source View Define a Data Source View Modifying the Default Table Names to more friendly names for management Document1 9 February 2016 1 of 12 TASK 1: How to start a new (AS) Analysis Services project Go back to a previous lab and see how to find the server name. There may be alternatives to get to 1 Click Start All Programs Business Intelligence Development Studio Microsoft Software Microsoft SQL Server 2008 SQL Server Business Intelligence Development Studio The Microsoft Visual Studio 2008 development environment opens. There may be recent projects that appear in the top left box already, particularly if you are working on your own computer. 2 Select File New Project. You can use Business Intelligence Development Studio to create several different types of projects, either from templates that are installed with Visual Studio or from templates that you define. The templates that are installed depend on which Microsoft SQL Server components you install. 3 In the New Project dialog box, in the Project types on the left side of the pane select Business Intelligence Projects. In the Templates pane (right side) select Analysis Services Project. Notice the default project name, the default solution name, and the default project location in the bottom of the dialog box. The default is called Analysis Services Project1. By default, a new directory will be created for the solution as your will enter a different name. Document1 9 February 2016 2 of 12 4 Change the project name to a name you will remember. In the example FM-##, where ## is your initials – mine would be FM-RT. Note the solution name changed also Click OK. You have successfully created the FM-RT project. It will appear in the top left pane. The pane is called Recent Projects. The following shows a screen similar to yours. Your project name appears in projects These 2 panes are visible and can be located anywhere within the window. They are usually found on the right side. The panes are docked, but can be moved. --- See next notes about some hidden panes Business Intelligence Development Studio Components When a new Analysis Services project opens, Solution Explorer and the Properties window on the right side are visible and docked. There are several hidden windows. They appear as tabs around the edges depending on where they are docked. In the above screenshot Toolbox is barely visible near the top left side. The other windows are The Server Explorer, Toolbox, Task List, Error List, and Output windows. To view a hidden window, position your pointer in the hidden window and it will reappear. To hide or unhide a window, click the Auto Hide button (looks like a cork board pin). If you accidentally close an open window, you can reopen it from the View menu. The following table describes the open windows when you open a new Analysis Services project. Solution Explorer Properties This window contains a tree few of the objects found in the solution. A solution can contain multiple projects As you build the solution subtitles will appear under data sources, data source views, and cubes etc. This window contains the properties for the items selected. Document1 9 February 2016 3 of 12 TASK 2: Define a Data Source After you create a Microsoft SQL Server Analysis Services (SSAS) project (FM-##), you generally start working with the project by defining one or more data sources that the project will use. When you define a data source, you are actually defining the connection string information that will be used to connect to the data source. You do not need to keep a record of the connection string. In the following task, you will be connecting to the FMXXX sample database provided as the data source for the FM-## project. A database that you are going to use is located on your local computer. Normal practice is that the databases are frequently hosted on one or more computers separate from where you’re working. ASIDE: As in the lecture portion it is better to keep the DW separate from the OLTP to avoid slowing performance of the OLTP system that is essential to normal day-to-day business. For these labs and the assignment keeping it on the same system is simpler. To define a new data source 1 In Solution Explorer (right side at top), right-click Data Sources, and then click New Data Source and the Data Source Wizard window will open. 2 On the Welcome to the Data Source Wizard page click Next. You can check the box that will prevent the welcome screen from appearing in the future. The Select how to define the connection page appears. On this page, you can define a data source Based on a new connection Based on a connection that already exists Based on a previously defined data source object A previously defined data source object is an existing data source definition within the current project or within another project in the current solution. In this tutorial, you will define a new data source based on a NEW connection or the first choice listed above. Document1 9 February 2016 4 of 12 3 On the Select how to define the connection page select NEW The Connection Manager box appears. Provider List In this dialog box you define connection properties for the data source. A connection manager is a logical representation of the connection that will be used at run time. For example, a connection manager includes a connection string property that you set at design time. At run time, a physical connection is created by using the values in the connection string property. 4 In the Provider list, at the top of the window, use the drop down to select Native OLE DB\SQL Server native Client 10.0 Analysis Services also supports other providers as you saw in the drop down list. 5 In the Server name text box, For the Lab pick the server that appears in the drop box Choose the computer name you found before that starts with SY-T2109-0\SQLEXPRESS …as an example After selecting the name, REMOVE the part that states any reference to INSTANCE or SQL EXPRESS. Just keep the SY-T2109-01or the one based on your machine For at home I have used DESK which is the name of my computer. In the past some have chosen localhost (all 1 word). When you deploy the project to a particular instance of Analysis Services, the Analysis Services engine will connect to DW database in the default instance of Microsoft SQL Server on the computer where the instance of Analysis Services resides. If you specify a particular computer name or IP address when you define a data source, the project or the deployed application will make the connection to the specified computer instead of to the local computer. The Analysis Services Deployment Wizard lets you specify the actual server name for the source data at deployment time. This next part is VERY important 6 Verify that Use Windows Authentication is selected. In the Select or enter a database name list, select FM-##. At this point you may have problems if you don’t remember the names. Document1 9 February 2016 5 of 12 You can try the Test Connection at bottom left 7 Click OK, to get the Select How to define the Connection window. You may see other variations due to many test runs in developing the labs. Then click Next. The Impersonation Information page appears. On this page of the wizard, Analysis Services (AS) requires you to define the security to use to connect to the data source. However, in this tutorial AS select the Analysis Services service account because this account has the necessary permissions to access the DW database. 8 Very important to remember as different installations such as your laptop or the school lab may be set differently by default. Select Use the service account, and then click Next. 9 On the Completing the Wizard page, Click Finish to create the new data source with the name FM-##. If you look at the Solution Explorer window you will see that FM-##.ds appears under data sources. NOTE: To modify the properties of an existing data source, double-click the data source in the Data Source folder to display the data source in Data Source Designer You have successfully defined the FM-## data source for the project. Document1 9 February 2016 6 of 12 TASK 3: Define a Data Source View After you define the data sources that you will use, the next step is generally to define a data source view for the project. What is a Data Source View? A data source view is a single unified view of the metadata from specified tables and views that the data source defines in the project. It is what data you are choosing to look at from the tables available. Storing the metadata in the data source view enables you to work with the metadata during development without an open connection to any underlying data source. To simplify we could build a cube without any connection to the underlying data. (The lab that did that has been removed as it is not the preferred choice for students on this course) In this lab you will build the cube using a connection to an existing DW. In the following task, you define a data source view that includes tables from the FM-## data source. To define a new data source view 1 In Solution Explorer, right-click Data Source Views, and then click New Data Source View. The Welcome to the Data Source View Wizard opens. 2 On the Welcome to the Data Source View Wizard page, click Next. The Select a Data Source page appears. Under Relational data sources, highlight the one you want. 3 Click Next. The Select Tables and Views page appears. Document1 9 February 2016 7 of 12 On this page, you select tables and views from the list of objects that are available from the selected data source. You can filter this list to help you in selecting tables and views. 4 In the Available objects list, select all the tables but NOT the sysdiagram 5 Click > to add the selected tables to the Included objects list. 6 Click Next, and you see this box. Now is the time to change the view name if you wanted to. Click Finish to define the FM-##. The resulting screen appears like the following. It may be spread out. It may or may not contain the connections between tables. The connections are usually there, but occasionally you may have to rebuild them. Document1 9 February 2016 8 of 12 To see the whole diagram in the case of a more complicated structure, click the magnifying glass on the toolbar specific to this window. The data source view FM-## appears in the Data Source Views folder in Solution Explorer. The contents of the data source view also displays in Data Source View Designer in Business Intelligence Development Studio. This designer contains the following elements: Diagram pane -- The tables and their relationships are represented graphically Tables pane -- The tables and their schema elements are displayed in a tree view. (Left) Diagram Organizer pane – Where subdiagrams can be created so that you can view subsets of the data source view A toolbar that is specific to Data Source View Designer. 7 Click the Maximize button to maximize the Microsoft Visual Studio development environment. 8 On the toolbar across the top of Data Source View Designer, use the Zoom icon (magnifying glass) to view the tables in the Diagram pane at 50 percent. This will hide the column details of each table. 9 On the title bar of Solution Explorer, the top right box, click the Auto Hide button, which is the pushpin icon. Solution Explorer minimizes and changes to a tab along the right side of the development environment. To view Solution Explorer again, position your pointer over the Solution Explorer tab. To unhide Solution Explorer, click the Auto Hide button again. 10 Click Auto Hide on the title bar of the Properties window, if the window is not hidden by default. Document1 9 February 2016 9 of 12 The following is a different example than what you see on your screen. What you see below is the result of reducing or hiding the right hand panes to give a larger viewing area. If all the dimension tables are directly connected to the Fact table as they are below then this would be a Star schema example. The schema that you see on your screen is again Snowflake schema because Product Subcategory and Product Category tables do not directly connect to the fact table, but connect through Product. In the example below, notice that there are three relationships between the FactInternetSales table and the DimTime table. Each sale has three dates associated with the sale: an order date, a due date, and a ship date. This is only showing you something different from what you will do later. To view the details of any relationship, double-click the relationship arrow in the Diagram pane. Try it on your diagram and see what appears. You have successfully created the FM-##. Save it. In the next lesson, you will gradually develop a cube. . Document1 9 February 2016 10 of 12 TASK 4: Modifying Default Table Names The data you imported for FM-## had user friendly names such as Employee already. However, having good names is not always the case. If you look at the example above you will find names such as DimGeography and DimTime for table names. If you are an IT person you would understand it as a dimension table for Geography or location and a dimension table for Time. The end-user of the cube is an executive or business analyst and understands the name Geography or the name Location. The notes from the AdventureWorksDW are left here in this lab in case you want to quickly read how it is done. The metadata for the tables and views in a data source view are derived from the metadata for these objects in the underlying data source. Business Intelligence Development Studio uses the metadata for the objects in the data source view to define dimensions, attributes, and measure groups. However, BI Development Studio uses the FriendlyName property of an object instead of its Name property. You can change the value of the FriendlyName property for objects in the data source view, to increase the user-friendliness of the names of the dimension and cube objects that are created from the data source view. You can also change the names of these objects after you define them. In the following task, you will change the friendly name of a table in the FM-## DW data source view. This will increase the user-friendliness of the cube and dimension objects that you will define in the next lesson. Note: You can also change the friendly names of columns, define calculated columns, and join tables or views in the data source view to increase their user-friendliness. You will learn about these options in subsequent lessons in this tutorial. To modify the default name of a table 1 In the Diagram pane (centre) of Data Source View Designer(dsv), right-click the SalesFact table, and then click Properties. If the properties pane appears as a tab, unhide it and pin it. 1 Click the Auto Hide button on the title bar of the Properties window so that this window will remain unhidden. It is easier to change the properties for each table in the data source view when the Properties window remains open. If you do not pin the window open by using the Auto Hide button, the window will close when you click a different object in the Diagram pane. 2 Change the FriendlyName property for the SalesFact object to FM SalesFact. Document1 9 February 2016 11 of 12 In the File menu, or on the toolbar of BI Development Studio, click Save All. This saves the changes you have made to this point in Labs, so that you can stop the labs here if you want and resume it later. NOTE: You may need to save to your own USB as the temp drive often gets wiped out on Seneca machines You have successfully changed the default table name. Had there been others such as EMP, it is a good idea to change the names to something that is more meaningful to upper management. Try to get away from IT short cut names or underscores. Names like LOCATION_DIM, meaning location dimension table should be changed. There are more things you can do and they are found Lab-991 to 993 which are available upon request. These other labs deal with more issues than the simplified set of labs you are doing known as FM labs. Document1 9 February 2016 12 of 12