Tải bản đầy đủ (.pdf) (5 trang)

SAS/Warehouse Administrator 2.3 Metadata API- P11 docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (453.87 KB, 5 trang )

Metadata API Class _UPDATE_METADATA_ 47
When you pass a list for a property of an object through the
_UPDATE_METADATA_ method, and the existing property list is empty for the
object — or if the list can be a list of objects, UPDATE will add (for independent
types) or create and add (for dependent types) the object to the existing list.
For example, given an existing job (WHJOB) with several output tables
associated with it, an existing detail table (WHDETAIL) will also be associated
with that job when it is passed in the output tables property in the
l_meta list for
the update of WHJOB. As another example, given an existing OLAP table
(WHOLPTBL) with several extended attributes (WHEXTATR) associated with it, a
new extended attribute will be created and associated with when it is passed in
the extended attributes property in the l_meta list for the update of WHOLPTBL.
When you pass a list for a property through the _UPDATE_METADATA_ method,
and the property can only be a list with a single object, UPDATE will replace the
existing object with another existing object that is being passed in l_meta.
For example, given that an OLAP table has an existing library (WHLIBRY)
associated with it, a call to the _UPDATE_METADATA_ method for the OLAP
table (WHOPLTBL) will replace the library with another existing library when it
is passed in the l_meta list for the update of WHOLPTBL.
Examples
Example 1: Add New Columns to the Selected Table
l_meta=makelist();
/*
* object_id is the ID of an existing Data Table object.
*/
l_meta=insertc(l_meta,object_id,-1,’ID’);
/*
* Define a column. The COLUMNS property
* contains a sublist per column.
*/


l_cols=makelist();
l_col=makelist();
l_cols=insertl(l_cols,l_col,-1);
l_meta=insertl(l_meta,l_cols,-1,’COLUMNS’);
col_id=repos_id||’.’||’WHCOLUMN’;
l_col=insertc(l_col,col_id,-1,’ID’);
l_col=insertc(l_col,’SaleDate’,-1,’NAME’);
l_col=insertc(l_col,’Date of Sale’,-1,’DESC’);
l_col=insertc(l_col,’N’,-1,’TYPE’);
l_col=insertn(l_col,8,-1,’LENGTH’);
l_col=insertc(l_col,’DATE7.’,-1,’FORMAT’);
l_col=insertc(l_col,’DATE7.’,-1,’INFORMAT’);
/*
* Update any additional properties.
48 _UPDATE_METADATA_ Chapter 2
*:
*:
*/
/*
* Update the table.
*/
call send(i_api,’_UPDATE_METADATA_’,l_rc,l_meta);
if l_rc = 0 then do;
put ’Table Updated successfully’;
end; /* if */
else do;
msg=getnitemc(l_rc,’MSG’,1,1,’ERROR:
_UPDATE_METADATA_ FAILED’);
put msg;
list_rc=dellist(l_rc);

end; /* else */
l_meta=dellist(l_meta,’Y’);
Example 2: Add Extended Attributes
/*
* object_id is the ID of an existing Data Table object.
*/
l_meta=makelist();
l_meta=insertc(l_meta,object_id,-1,’ID’);
/*
* Attributes
*/
l_attrs=makelist();
l_attr=makelist();
l_attr=insertc(l_attr,’Loader’,1,’NAME’);
l_attr=insertc(l_attr,’Oracle’,-1,’VALUE’);
l_attr=insertc(l_attr,’Name of loader used’,-1,’DESC’);
l_attrs=insertl(l_attrs,l_attr,-1);
l_meta=insertl(l_meta,l_attrs,-1,’EXTENDED ATTRIBUTES’);
call send(i_api, ’_UPDATE_METADATA_’,l_rc,l_meta);
Metadata API Class _UPDATE_METADATA_ 49
See Also
_DELETE_METADATA_, _ADD_METADATA_
50
51
CHAPTER
3
SAS/Warehouse Administrator
Metadata Types
Overview of SAS/Warehouse Administrator Metadata Types
51

What Is a Metadata Type?
52
Metadata Repository Types
52
Metadata Type Inheritance
52
Using Metadata Types
53
Relationships Among Metadata Types 53
Independent and Dependent Metadata Objects
53
General Metadata Type Model
53
Host Metadata Type Model
54
Table Property Metadata Type Model
55
Table Process Metadata Type Model
55
Process Type Model 56
Physical Storage Metadata Type Models 57
OLAP Metadata Type Model 58
Column Mapping Types: ODD to Detail Table Model 58
Writing Metadata 59
Writing Explorer Objects 59
Overview of the Process Editor 61
Reading Process Flow Metadata 62
Loadable Tables and WHTABLE Subtypes 63
Intermediate Output Tables and WHTBLPRC Subtypes 64
Process Objects and WHPROCES Subtypes 64

INPUT and OUTPUT Properties 64
Input Tables, Output Tables, and Job Metadata 65
Reading Job Metadata 65
Reading Job Flow Metadata 66
Reading Job Hierarchy Metadata 68
Using Icon Information 69
Index to SAS/Warehouse Administrator Metadata Types 70
Using the Metadata Type Dictionary 73
General Identifying Information 73
Overview of SAS/Warehouse Administrator Metadata Types
This section describes the metadata types that are defined for SAS/Warehouse
Administrator. These types are grouped under the WHOUSE component. They are
stored in the SASHELP.DWAPI catalog. For a complete list of these types, see “Index to
SAS/Warehouse Administrator Metadata Types” on page 70.
To use a metadata type, you pass its ID (such as WHDETAIL) to the metadata API
methods listed in “Index to Metadata API Methods” on page 16.

×