Saturday 23 November 2019

Data provisioning 2: Uploading data from flat files( for long length table)

if we are loading data in to an existing table in a schema, the data types and length must match in the files and tables, otherwise, we end up with errors while loading data. whereas ,when a table is created while loading data,data types and length will be given by the system according to the data in the file.


if a table is not available,the system will create a table in the required schema.





Step 1: selecting the source file and the target table in SAP HANA.

From Quick Launch, select Import, then select Data from Local File and click on Next, as shown in the following screenshot.


                                         









Click on Browse and select the file.According to the data in the flat file, there are several options available to load data from the flat file to SAP HANA. They are discussed as follows:

  1. Selecting Worksheet: if there are many Worksheets in Excel,we can select which worksheet's data to load by selecting it from the drop-down menu.
  2. Header rows: if the file has header rows,we can eliminate them by selecting the checkbox. there may be more header rows in the file. Hence, the number of header rows field will be enabled,allowing us to enter the number of header rows to be ignored.
  3. Importing all data:  This provides an option to either load all the data or selectively load data.By unchecking the import all data checkbox, two more fields will be enabled to enter Start Line and End Line. only the data in the range of these lines will be loaded.
  4. Ignore leading and trailing white-space(s) in the file: This option eliminates all the leading/trailing whitespaces in the data, thereby kind of cleansing the data before loading.
These options are illustrated in the following screen shot:

                                                     

in the bottom portion of the File Import Wizard screen, select NEW, and then select the appropriate schema and table name.


Step2 : in the next fields, schema has to be selected and a new table name has to be given as Table Name. This will create a table in the schema selected, as shown in the following screenshot:


                                                                           

the system will propose new fields in the table, with the same names as that of the file, and the same data type as well. The next step remains the same, mapping and completing the data load,as shown in the following screenshot:




Step 3: field mapping and loading data

After performing the step2, the screen prompts to mapping area.Here we need to map the fields of  file and the table fields.we can manually map by selecting each field and dragging it to the other side. From the system side, we will have 2 options: one -to-one and Map by name. Mapping can be done according to the fields, in this case, we go with one-on-one as the source and target fields are in the same sequence, as shown in the following screenshot.


in the mapping screen, we can see sample data from the file. after the fields are mapped, click on next to preview the data from both the file and the existing table.if data preview is not necessary and data has to be loaded on the go,select Finish.The confirmation is shown in the following screen shot:

                                                                             
 A job runs in the background to import the flat file and completes when the data is successfully imported. A data preview of the table will confirm the data is loaded,as shown in the following screenshot:

  1. right click on the data and select data preview.
  2. data preview on the table, with Reults.

    Thus,data is successfully loaded into the SAP HANA system from a flat file. 
Note: By default, a column table is created; we can see this in the top-right corner of the screen,if a row table is specifically required, Store Type should be changed to ROW store.on doing this the system will generate row table instead of column table.

No comments:

Post a Comment