Schema

Denodo GraphQL Service automatically creates the GraphQL schema from the metadata of the views and stored procedures of a Denodo database.

Denodo 'hibernate' database model

Denodo ‘hibernate’ database model

The GraphQL Service generates a query type for each view and each stored procedure. The view fields appear as children of the view object, and the same occurs for the parameters, in the case of stored procedure objects. Associations in Denodo are mapped to nested relationships between the different objects, so the GraphQL queries will fetch related objects and their fields in one request.

Besides being able to use the standard GraphQL introspection mechanisms, you can easily obtain the schema of a Denodo database sending a GET request to the GraphQL Service to: http://localhost:9090/denodo-graphql-service/graphql/<DBNAME>/schema.json

Schema request for Denodo 'hibernate' database

Schema request for Denodo ‘hibernate’ database

The schema describes the set of possible data you can query for that Denodo database. For example, for the Denodo ‘hibernate’ database model above, the Denodo GraphQL Service generates this schema:

Schema for Denodo ‘hibernate’ database
type Query {
    order(cust_id: Int, order_id: Int, total_price: BigInteger, order_desc: String, order_date: Timestamp, last_updated_time: Timestamp, _first: Int, _offset: Int): [order]!

    order_detail(order_id: Int, prod_id: Int, price: BigInteger, last_updated_time: Timestamp, _first: Int, _offset: Int): [order_detail]!

    product(prod_id: Int, prod_name: String, prod_desc: String, regular_price: BigInteger, last_updated_time: Timestamp, _first: Int, _offset: Int): [product]!
}

type order {
  cust_id: Int
  order_id: Int
  total_price: BigInteger
  order_desc: String
  order_date: Timestamp
  last_updated_time: Timestamp
  order_detail: [order_detail]!    # Denodo association
}

type order_detail {
  order_id: Int
  prod_id: Int
  price: BigInteger
  last_updated_time: Timestamp
  orders: order    # Denodo association
  product: product
}

type product {
  prod_id: Int
  prod_name: String
  prod_desc: String
  regular_price: BigInteger
  last_updated_time: Timestamp
  order_detail: [order_detail]!    # Denodo association
}

#Custom Scalar for Timestamp. This type uses ISO8601
scalar Timestamp

Custom Scalar Types

The Denodo GraphQL Service includes custom scalar types for handling Denodo types not defined in the GraphQL specification:

  • Array: custom scalar for Denodo Array. It is displayed as a String, but it is not supported as an argument in GraphQL queries.

    Array format
    "array_type": "[{value=666-987-8549}, {value=555-125-7841}]"
    
  • Blob: custom scalar for Denodo Blob. It is displayed as a String, but it is not supported as an argument in GraphQL queries.

  • LocalDate: custom scalar for Denodo LocalDate. This type formats and parses dates following the ISO-8601 extended local date format: yyyy-MM-dd.

    LocalDate format
    "date_type": "2018-02-04"
    
  • IntervalDaySecond: custom scalar for Denodo Intervaldaysecond. It is displayed as a String, but it is not supported as an argument in GraphQL queries.

    IntervalDaySecond format
    "intervalds_type": "1 21:01:02.345"
    
  • IntervalYearMonth: custom scalar for Denodo Intervalyearmonth. It is displayed as a String, but it is not supported as an argument in GraphQL queries.

    IntervalYearMonth format
    "intervalym_type": "-2-3"
    
  • Struct: custom scalar for Denodo Register. It is displayed as a String, but it is not supported as an argument in GraphQL queries.

    Struct format
    "struct_type": "{SALARY=32330.04, NAME=Diane O'Donnell}"
    
  • Time: custom scalar for Denodo Time. This type formats and parses times following the ISO-8601 extended local time format: hh:mm:ss[.sss].

    Time format
    "time_type": "16:06:11"
    
  • Timestamp: custom scalar for Denodo Timestamp. This type formats and parses times following the ISO-8601 extended local date and time formats. T delimiter between date and time is omitted: yyyy-MM-dd hh:mm:ss[.sss].

    Timestamp format
    "timestamp_type": "2018-02-04 17:07:06"
    
  • Timestamptz: custom scalar for Denodo Timestamptz. This type formats and parses times following the ISO-8601 extended local date and time formats, including the time zone designator. T delimiter between date and time is omitted: yyyy-MM-dd hh:mm:ss[.sss](±hh:mm:ss|Z).

    Timestamptz format
    "timestamptz_type": "2018-02-04 16:07:06Z"
    
  • Xml: custom scalar for Denodo Xml. It is displayed as a String, but it is not supported as an argument in GraphQL queries.