Custom Schema Definitions
In addition to Automatic Schema Discovery the component also allows you to statically define the schema for your Amazon DynamoDB table. Let's consider a schema for the restaurants data set.
Below is an example item from the table:
{ "address":{ "building":"461", "coord":[ -74.138492, 40.631136 ], "street":"Port Richmond Ave", "zipcode":"10302" }, "borough":"Staten Island", "cuisine":"Other", "grades":[ ], "name":"Indian Oven", "restaurant_id":"50018994" }
Defining a Custom Schema
You can define a custom schema to extract out nested properties as their own columns. Set the Location property to the file directory that will contain the schema file.The following schema uses the other:path property to define where the data for a particular column should be retrieved from. Using this model you can flatten arbitrary levels of hierarchy.
The 'other:tableapiname' attribute specifies the table to parse. This attribute gives you the flexibility to use multiple schemas for the same table.
In Custom Schema Example, you will find the complete schema that contains the example above.
<api:info title="StaticRestaurants" other:catalog="CData" other:schema="AmazonDynamoDB" description="StaticRestaurants" other:tableapiname="StaticRestaurants" other:version="20">
<attr name="id" xs:type="decimal" key="true" columnsize="17" precision="38" scale="6" readonly="false" description="Dynamic Column." other:dynamodatatype="N" other:relativepath="restaurant_id" other:filterable="true" other:fullpath="restaurant_id" other:apiname="&quot;restaurant_id&quot;" />
<attr name="borough" xs:type="string" columnsize="2000" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="borough" other:filterable="true" other:fullpath="borough" other:apiname="&quot;borough&quot;" />
<attr name="address_zipcode" xs:type="int" columnsize="4" precision="10" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="zipcode" other:filterable="true" other:fullpath="address.zipcode" other:apiname="&quot;address&quot;.&quot;zipcode&quot;" />
<attr name="address_coord_0" xs:type="double" columnsize="8" precision="15" readonly="false" description="Dynamic Column." other:dynamodatatype="N" other:relativepath="coord" other:filterable="true" other:fullpath="address.coord[0]" other:apiname="&quot;address&quot;.&quot;coord&quot;[0]" />
<attr name="address_coord_1" xs:type="double" columnsize="8" precision="15" readonly="false" description="Dynamic Column." other:dynamodatatype="N" other:relativepath="coord[1]" other:filterable="true" other:fullpath="address.coord[1]" other:apiname="&quot;address&quot;.&quot;coord&quot;[1]" />
<attr name="address_building" xs:type="int" columnsize="4" precision="10" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="building" other:filterable="true" other:fullpath="address.building" other:apiname="&quot;address&quot;.&quot;building&quot;" />
<attr name="address_street" xs:type="string" columnsize="2000" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="street" other:filterable="true" other:fullpath="address.street" other:apiname="&quot;address&quot;.&quot;street&quot;" />
<attr name="name" xs:type="string" columnsize="2000" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="name" other:filterable="true" other:fullpath="name" other:apiname="&quot;name&quot;" />
<attr name="cuisine" xs:type="string" columnsize="2000" readonly="false" description="Dynamic Column." other:dynamodatatype="S" other:relativepath="cuisine" other:filterable="true" other:fullpath="cuisine" other:apiname="&quot;cuisine&quot;" />
</api:info>