ODBC Driver for GraphQL

Build 24.0.9062

カラム定義

The basic attributes of a column are the name of the column, the data type, whether the column is a primary key, the relative path and the depth. The 本製品 uses the depth attribute to extract nodes from hierarchical data.

Mark up column attributes in the block of the schema file. You can also provide a description of each attribute using the desc property.

 <rsb:script xmlns:rsb="http://apiscript.com/ns?v1" xmlns:xs="http://www.cdata.com/ns/rsbscript/2" xmlns:other="http://apiscript.com/ns?v1"> 
   <rsb:info title="Labels" desc="Lists information about the different labels you can apply on an issue." other:possiblePaths="{'path':'/repository/labels/edges/node','Name':{'path':'/repository/label'}}" other:paginationObjects="{'labels':{'cursorPath':'after','cursorType':'String','pageSizeArgumentPath':'first','pageSizeArgumentType':'Int','depth':'1','paginationType':'Cursor','isConnection':'True','pageInfo':['endCursor','hasNextPage','hasPreviousPage','startCursor']}}"> 
     <attr   name="Id"               xs:type="string"     key="true"   other:relativePath="id"             desc="The ID of the label."                                                                                                                                                                                                                                                                                                                  /> 
     <attr   name="RepositoryName"   xs:type="string"                            other:relativePath="name"           desc="The name of the repository."                                     other:filter="name:="    other:argumenttype="String!"    other:depth="1"                                           references="Repositories.Name"                                                                             /> 
     <attr   name="UserLogin"        xs:type="string"                                                                          desc="The login name of the user."                                     other:filter="owner:="   other:argumenttype="String!"    other:depth="1"                                           references="Users.Login"         other:mirror="true"         other:canBeSliced="true"  /> 
     <attr   name="Color"            xs:type="string"                            other:relativePath="color"          desc="Identifies the label color."                                                                                                                                                                                                                                                                                                           /> 
     <attr   name="CreatedAt"        xs:type="datetime"                          other:relativePath="createdAt"      desc="Identifies the date and time when the label was created."                                                                                                                  other:orderby="CREATED_AT"                                                                                                                        /> 
     <attr   name="Description"      xs:type="string"                            other:relativePath="description"    desc="A brief description of this label."                                                                                                                                                                                                                                                                                                    /> 
     <attr   name="IsDefault"        xs:type="boolean"                           other:relativePath="isDefault"      desc="Indicates whether or not this is a default label."                                                                                                                                                                                                                                                                                     /> 
     <attr   name="Name"             xs:type="string"                            other:relativePath="name"           desc="Identifies the label name."                                      other:filter="name:="    other:argumenttype="String!"                                 other:orderby="NAME"                                                    other:isPathFilter="true"                                       /> 
     <attr   name="ResourcePath"     xs:type="string"                            other:relativePath="resourcePath"   desc="The HTTP path for this label."                                                                                                                                                                                                                                                                                                         /> 
     <attr   name="UpdatedAt"        xs:type="datetime"                          other:relativePath="updatedAt"      desc="Identifies the date and time when the label was last updated."                                                                                                                                                                                                                                                                         /> 
     <attr   name="Url"              xs:type="string"                            other:relativePath="url"            desc="The HTTP URL for this label."                                                                                                                                                                                                                                                                                                          /> 
   </rsb:info> 

   <rsb:script method="GET"> 
     <rsb:push op="graphqladoSelect" /> 
   </rsb:script> 

 </rsb:script>
The following sections provide more detail on using paths to extract columns and rows. To see the column definitions in a complete schema, refer to スキーマのカスタマイズ.

Mapping SELECT Projection to GraphQL Fields

Control the building process of a GraphQL field path with the properties listed below:

  1. The other:possiblePaths property is used to specify the base paths that select the column's value.

    Base paths start with a '/' and contain the full path to the last GraphQL nested object.

      <rsb:info title="Labels" desc="Lists information about the different labels you can apply to an issue." other:possiblePaths="{'path':'/repository/labels/edges/node','Name':{'path':'/repository/label'}}" other:paginationObjects="{'labels':{'cursorPath':'after','cursorType':'String','pageSizeArgumentPath':'first','pageSizeArgumentType':'Int','depth':'1''paginationType':'Cursor','isConnection':'True','pageInfo':['endCursor','hasNextPage','hasPreviousPage','startCursor']}}">
    The following GraphQL query is based on the above script example:
    { # base path=/repository/labels/edges/node
      repository {
        labels {
          edges {
            node {
              ...
            }
          }
        }
      }
    }

  2. The other:relativePath property must be specified for each column. This property is used in conjuction with the other:possiblePaths property to build the GraphQL field path.

      <attr   name="Name"  xs:type="string"  other:relativePath="name"  desc="Identifies the label name."    />
    Based on the above script example the 本製品 will build the following GraphQL query:
    { # base path=/repository/labels/edges/node
      repository { # depth=1 
        labels { # depth=2
          edges {
            node {
              name # path=base path + relative path.
            }
          }
        }
      }
    }

  3. Use the other:depth property to specify an element inside a specific GraphQL object. The indexes are 1-based. If this attribute is not specified then the default value will be equal to the last nested GraphQL object.

      <attr   name="RepositoryName"   xs:type="string"  other:relativePath="name"   desc="The name of the repository."  other:depth="1" />
    The following GraphQL query is built from the above script example:
    { # base path=/repository/labels/edges/node
      repository { # depth=1 
        name # This is mapped to the RepositoryName column
        labels { # depth=2
          edges {
            node {
              ...
            }
          }
        }
      }
    }

  4. Use the other:fragment property to specify a group of fields. This property can be used when the GraphQL server returns an array of objects and the 本製品 may need to push this info as an aggregate.

      <attr   name="ColumnValues"   xs:type="string"  other:relativePath="column_values"   desc="Column values."  other:fragment="fragment ItemColumnValues on ColumnValue {  id \\r\\n value }" />
    Based on the above script example, the 本製品 will build the following GraphQL query:
    query {
        items {
            column_values {
                ...ItemColumnValues
            }
        }
    }
    fragment ItemColumnValues on ColumnValue {
        id
        value
    }

  5. Use the other:canbesliced property enable slicing behavior in the 本製品

    For example,

    SELECT * FROM Table WHERE Col IN ('1','2','3')
    becomes
    SELECT * FROM Table WHERE Col=1
    SELECT * FROM Table WHERE Col=2
    SELECT * FROM Table WHERE Col=3

  6. Use the other:mirror property to reflect the value specified in the criteria. Use on columns that are not specified in the server response.

    For example:


    SELECT * FROM Table WHERE Col=X (If other:mirror=true the 本製品 will artificially set the value of Col to X for every row.)
  7. Use references to reference the key column of the parent table. Example: If there are two tables Orders and OrderLineItems and the OrderLineItems has a column OrderId, the references field for this column will be "Orders.Id".

Notes:

  • Paths and column names (when used to generate the path) are case sensitive.
  • At least one possible path should be specified.
  • The other:relativePath property must be specified for every column. Otherwise, the 本製品 cannot map the SELECT column to a GraphQL field.

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