28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.9.1 Table-Import Model<br />

The table-import model is a configuration file that you use to specify the parameters associated with the list of<br />

comma-separated-value (CSV) files that you want to import. The table-import model also specifies, for each<br />

parameter, into which table the linked-data files are imported, for example, the CSV files linked in the table-import<br />

data file.<br />

You can declare a parameter as optional. If a parameter is optional, it is not necessary to assign a value to this<br />

parameter in the implementing table import data object. To declare a variable as optional in the table-import<br />

model, add the keyword optional before the variable, as illustrated in the example below.<br />

optional listCsvFile csvList;<br />

If you want to add comments to your table-import model, use two back slashes (//) as illustrated in the example<br />

below.<br />

listCsvFile fileList; //this is the csv file list<br />

Example Table-Import Model File<br />

listCsvFile csvFiles;<br />

import csvFiles "TISCHEMA" "TiPackage::TiTable";<br />

5.9.2 Table-Import Data<br />

The table-import data configuration file enables you to specify which table-import model is to be implemented, for<br />

example, TiModel.hdbtim. The file-list parameters created in the table import-model file are assigned to lists of<br />

data-file links, for example, comma-separated values (.csv) files. In the example illustrated below, the .csv is<br />

called TiCsv.csv.<br />

If you want to add comments to your table-import model, use two back slashes (//) as illustrated in the example<br />

below.<br />

implements TiPackage:TiModel.hdbtim; //This is a the import model<br />

You can declare a parameter as final. If a parameter is defined as final, you can prevent modifications of values<br />

assigned to file lists, for example, in a table-import extension. To declare a variable as final in the table-import data<br />

file, add the keyword final before the variable, as illustrated in the example below.<br />

final csvFiles = ["sap.mypackage:data.csv"];<br />

Example Table-Import Data File<br />

implements TiPackage:TiModel.hdbtim; //This is a comment<br />

csvFiles = ["TiPackage:TiCsv.csv"];<br />

csvFilesExt = [<br />

{<br />

file="TiPackage:TiCsv.csv"<br />

},<br />

{<br />

header = false;<br />

file = "sap.xse:csv_config.csv";<br />

keys = [ "Col1" : "b*", "Col1" : "a"];<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Setting Up the Persistence Model<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!