CData Python Connector for Azure Cosmos DB

Build 24.0.9060

Custom Schema Example

This section contains a complete schema. The info section enables a relational view of a Azure Cosmos DB object. For more details, see Custom Schema Definitions. The table below allows the SELECT, INSERT, UPDATE, and DELETE commands as implemented in the GET, POST, MERGE, and DELETE sections of the schema below.

Copy the rows@next input as-is into your schema. The operations, such as cosmosdbadoSysData, are internal implementations and can also be copied as is.

Set the Location property to the file directory that will contain the schema file.

When, creating custom schemas, the attr for _rid, shown below, is required.

Also required are three properties for the _rid column definition:

  • other:dbrid is found in the _self property of an item in the collection, after "dbs/".
  • other:collrid is found in the _self property of an item in the collection, after "/colls/".
  • other:partitionpath refers to the name of the partition specified when the collection was created.

<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:script method="GET">
    <rsb:call op="cosmosdbadoSysData">
      <rsb:push />
    </rsb:call>
  </rsb:script>

  <rsb:script method="POST">
    <rsb:call op="cosmosdbadoSysData">
      <rsb:push />
    </rsb:call>
  </rsb:script>

  <rsb:script method="MERGE">
    <rsb:call op="cosmosdbadoSysData">
      <rsb:push />
    </rsb:call>
  </rsb:script>

  <rsb:script method="DELETE">
    <rsb:call op="cosmosdbadoSysData">
      <rsb:push />
    </rsb:call>
  </rsb:script>

</rsb:script>

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060