The following AddMetadata
request creates a table object, column objects, and an association
to the previously defined SASLibrary object in a single method call.
The SAS Metadata Model supports several metadata types for describing
tables. In this example, the PhysicalTable metadata type is used to
represent a table that is materialized in a file system. A PhysicalTable
object is associated to a Column object with a Columns association.
A PhysicalTable object is associated to a SASLibrary object with
a TablePackages association.
<AddMetadata>
<Metadata>
<PhysicalTable Name="Sales Offices" Desc="Sales offices in NW region"
PublicType="Table">
<TablePackages>
<SASLibrary ObjRef="A53TPPVI.A1000001"/>
</TablePackages>
<Columns>
<Column
Name="City"
Desc="City of Sales Office"
ColumnName="City"
SASColumnName="City"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column"/>
<Column
Name="Address"
Desc="Street Address of Sales Office"
ColumnName="Address"
SASColumnName="Street_Address"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column"/>
<Column
Name="Manager"
Desc="Name of Operations Manager"
ColumnName="Manager"
SASColumnName="Manager"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column"/>
<Column
Name="Employees"
Desc="Number of employees"
ColumnName="Employees"
SASColumnName="Employees"
ColumnType="6"
SASColumnType="N"
ColumnLength="3"
SASColumnLength="3"
SASFormat="3.2"
SASInformat="3.2"
PublicType="Column"/>
</Columns>
</PhysicalTable>
</Metadata>
<Reposid>A0000001.A53TPPVI</Reposid>
<NS>SAS</NS>
<Flags>268435456</Flags>
<Options/>
</AddMetadata>
In the request, the
<REPOSID>, <NS>, and <FLAGS> elements contain the
same values as in Example of an AddMetadata Request That Creates a SAS Metadata Model Object. In the <METADATA> property
string, note the following:
-
<PHYSICALTABLE> is the metadata
type. Name, Desc, and PublicType are attributes of the PhysicalTable
metadata type.
-
<TABLEPACKAGES> is the association
name that creates the association to the SASLibrary object. The ObjRef
attribute in the <SASLIBRARY> subelement informs the SAS Metadata
Server that the association is being created to an existing object.
-
<COLUMNS> is the association
name that creates the associations to the Column objects. The column
definitions are nested under the Columns association name.
-
Four Column objects are created.
For each object, consider the following:
-
Name is a required attribute.
-
The ColumnName, ColumnType, and
ColumnLength attributes describe the names and values of the items
in a DBMS.
-
The SASColumnName, SASColumnType,
and SASColumnLength attributes indicate their corresponding values
in a SAS table.
-
A ColumnType value of 12 indicates
VARCHAR. A ColumnType value of 6 indicates FLOAT.
For more information
about the properties for the PhysicalTable and Column metadata types,
see the SAS Metadata Model documentation.
Here is an example of
the output returned by the SAS Metadata Server:
<!-- Using the ADDMETADATA method. -->
<PhysicalTable Name="Sales Offices" Desc="Sales offices in NW region"
Id="A53TPPVI.A4000001">
<TablePackages>
<SASLibrary ObjRef="A53TPPVI.A1000001"/>
</TablePackages>
<Columns>
<Column Name="City" Desc="City of Sales Office" ColumnName="City"
SASColumnName="City" ColumnType="12" SASColumnType="C" ColumnLength="32"
SASColumnLength="32" SASFormat="$Char32." SASInformat="$32."
PublicType="Column" Id="A53TPPVI.A5000001">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000001"/>
</Table>
</Column>
<Column Name="Address" Desc="Street Address of Sales Office"
ColumnName="Address" SASColumnName="Street_Address" ColumnType="12"
SASColumnType="C" ColumnLength="32" SASColumnLength="32" SASFormat="$Char32."
SASInformat="$32." PublicType="Column" Id="A53TPPVI.A5000002">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000001"/>
</Table>
</Column>
<Column Name="Manager" Desc="Name of Operations Manager" ColumnName="Manager"
SASColumnName="Manager" ColumnType="12" SASColumnType="C" ColumnLength="32"
SASColumnLength="32" SASFormat="$Char32." SASInformat="$32."
PublicType="Column" Id="A53TPPVI.A5000003">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000001"/>
</Table>
</Column>
<Column Name="Employees" Desc="Number of employees" ColumnName="Employees"
SASColumnName="Employees" ColumnType="6" SASColumnType="N" ColumnLength="3"
SASColumnLength="3" SASFormat="3.2" SASInformat="3.2" PublicType="Column"
Id="A53TPPVI.A5000004">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000001"/>
</Table>
</Column>
</Columns>
</PhysicalTable>
The output string mirrors
the input string, with the exception that a two-part metadata object
identifier is assigned to each new metadata object.