
Case sensitivity of column names in SQL Server We used all uppercase for the column names above because the Warehouse Builder defaults the case to upper for any column name that we enter. However, this could cause a problem later while retrieving data from the SQL Server tables using those column names if the case does not match the way they are defined in SQL Server. SQL Server will allow mixed case for column names, but the Oracle database assumes all uppercase for column names. It is possible to query a mixed-case column name in SQL Server from an Oracle database, but the name must be enclosed in double quotes. The code generated by the Warehouse Builder recognizes this and puts double quotes around any references to column name. If the import had worked, it would have created the column names with matching case and there would have been no problem. However, when the Table Editor manually enters columns, it has no option to enter a mixed-case name. We’ll run into errors later if the corresponding SQL Server column names are not in all uppercase. The database scripts that can be downloaded from the Packt website (http://www.packtpub. com/files/code/344 9_Code) to build the database contain the column names in all uppercase to avoid any problems. To import the remainder of the tables automatically using the wizard, just follow the steps described above for importing source table metadata but start the import by right clicking on the acme_pos database node under ODBC instead of the Oracle node. The remainder of the import steps are as documented previously.Be sure to save each table as it is created to make sure no work gets lost. When all the tables are entered or imported, our defining and importing of source metadata is completed. Importing source metadata from files One final object type we need to discuss before we wrap up the source metadata importing and defining is the importing of data object metadata from a file. The Warehouse Builder can take data from a flat file and make it available in the database as if it were a table, or just load it into an existing table. The metadata that describes this file must be defined or imported in the Warehouse Builder. The file format must be delimited, usually with commas separating each column and a carriage return at the end of a record (CSV file). The option to use a flat file greatly expands the flexibility of the Warehouse Builder because now it allows us to draw upon data from other sources, and not just databases. That can also be of great assistance even in loading data from a database if the database is not directly network accessible to our data warehouse. In that case, the data can be exported out of the source database tables and saved to a CSV file for us to import. For our ACME Toys and Gizmos company data warehouse, we’ve been provided a flat file. This file contains information for counties in the USA that the management wanted to see in the data warehouse to allow analyzing by county. For stores in the USA, the store number includes a code that identifies the county the store is located in, and the flat file we’ve been provided with contains the cross reference of the code to the county that we’ll need. The file name is counties.csv and it is available in the download files from the Packt website at http://www.packtpub.com/files/ code/3449_Code. The process of creating the module and importing the metadata for a flat file is different from Oracle or non-Oracle databases because we’re dealing with a file in the file system now instead of a database. The steps involved in creating the module and importing the metadata for a flat file are as follows: 1. The first task we need to perform, as we did earlier for the source databases, is to create a new module to contain our file definition. If we look in the Projects tab under our project, we’ll see that there is a Files node right below the Databases node. We will launch the Create Module Wizard the same way as we did earlier, but we’ll do it on the Files node and not the Databases node. We’ll right- click on the Files node and select New Flat File Module from the pop-up menu to launch the wizard. 2. When we click on the Next button on the Welcome screen, we notice a slight difference already. The Step 1 of the Create Module wizard only asks for a name and description. The other options we had for databases above are not applicable for file modules. We’ll enter a name of ACME_FILES and click on the Next button to move to Step 2. 3. We need to edit the connection in Step 2 just as we did for the database previously. So we’ll click on the Edit button and immediately notice the other major difference in the Create Module Wizard for a file compared to a database. As we see in the following image, it only asks us for a name, a description, and the path to the folder where the files are: The Name field is prefilled with the suggested name based on the module name. As it did for the database module location names, it adds that number 1 to the end. So, we’ll just edit it to remove the number and leave it set to ACME_FILES_ LOCATION. 1. Notice the Type drop-down menu. It has two entries: General and FTP. If we select FTP (File Transfer Protocol—used for getting a file over the network), it will ask us for slightly more information as shown in the following image: The FTP option can be used if the file we need is located on another computer. We will need to know the name of the computer, and have a logon username and password to access that computer. We’ll also need to know the path to the location of the file. This option is used in process flows which is a more advanced option than we’ll be able to cover in this topic. 2. The simplest option is to store the file on the same computer on which we are running the database. This way, all we have to do is enter the path to the folder that contains the file. We should have a standard path we can use for any files we might need to import in the future. So we create a folder called GettingStartedWithOWB_files, which we’ll put in the C: drive. Choose any available drive with enough space and just substitute the appropriate drive letter. We’ll click on the Browse button on the Edit File System Location dialog box, choose the C:\GettingStartedWithOWB_files path, and click on the OK button. 3. We’ll then check the box for Import after finish and click on the Finish button. We could click the Next> button here and it would just take us to a screen summarizing what it’s going to do and then we’d hit the Finish button. That’s it for the Create Module Wizard for files. It’s really very straightforward. The File Import appears next. We’ll work through this one in a little more detail as it is different from importing from a database. If the File Import window has not appeared, then just right-click on the module name under the Files node under our project, and select Import and then Flat File…. The following are the steps to be performed in the File Import screens: 1. The first screen for importing a file is shown in the following screenshot: This is where we will specify the file we wish to import. We’ll click Add Sample File. and select the counties.csv file. After selecting the file from the resulting popup, it will fill in the filename on the File Import screen. The View Sample File. button is now no longer grayed out so we can click on it. It will show us a view of the file we’ve just selected so we can verify it’s the correct data as shown next: 2. If we’ve viewed the file we’ll just click OK to close the dialog. We’ll click the Import button now on the File Import screen to begin the import process. We are presented with an entirely new screen that we haven’t seen before. This is Flat File Sample Wizard, which has now been started. The Flat File Sample Wizard now has two paths that we can follow through it, a standard sequence for simple files and an advanced sequence for more complex files. The previous release included all these steps into one so we had no choice but now if we have a simple CSV file to import, we can save some time. The two sets of steps are indicated on the Welcome screen as shown below: 3. Clicking the Next button will take us to the first step which is shown below: This screen displays the information the wizard pulled out of the file, displayed as columns of information. It knows what’s in the columns because the file has each column separated by a comma, but doesn’t know at this point what type of data or column name to use for each column—so it just displays the data.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-