Custom Schema Definitions
You can extend the table schemas created with Automatic Schema Discovery by saving them into schema files. The schema files have a simple format that makes the schemas to edit.
Generating Schema Files
Set GenerateSchemaFiles to "OnStart" to persist schemas for all tables when you connect. You can also generate table schemas as needed: Set GenerateSchemaFiles to "OnUse" and execute a SELECT query to the table.
For example, consider a schema for the restaurants data set. This is a sample data set provided by Azure Cosmos DB.
Below is an example document from the collection:
{ "address":{ "building":"461", "coord":[ -74.138492, 40.631136 ], "street":"Port Richmond Ave", "zipcode":"10302" }, "borough":"Staten Island", "cuisine":"Other", "name":"Indian Oven", "restaurant_id":"50018994" }
Customizing a Schema
When GenerateSchemaFiles is set, the cmdlet saves schemas into the folder specified by the Location property. You can then change column behavior in the resulting schema.
The following schema uses the other:bsonpath property to define where in the collection to retrieve the data for a particular column. Using this model you can flatten arbitrary levels of hierarchy.
Below are the corresponding column definitions for the restaurants data set. In Custom Schema Example, you will find the complete schema.
<rsb:script xmlns:rsb="http://www.rssbus.com/ns/rsbscript/2">
<rsb:info title="StaticRestaurants" description="Custom Schema for the restaurants data set.">
<!-- Column definitions -->
<attr name="_rid" xs:type="string" key="true" other:collrid="hWdRAKRi3Pg=" other:dbrid="hWdRAA==" other:partitionpath="/name" />
<attr name="borough" xs:type="string" />
<attr name="cuisine" xs:type="string" />
<attr name="address.building" xs:type="string" />
<attr name="address.street" xs:type="string" />
<attr name="address.coord.0" xs:type="double" />
<attr name="address.coord.1" xs:type="double" />
<input name="rows@next" desc="Internal attribute used for paging through data." />
</rsb:info>
<rsb:set attr="collection" value="restaurants"/>
</rsb:script>