Skip to main content
Version: v3.x

Data Connector Links

Introduction

A DataConnectorLink is a used to specify the URLs and NDC schema of a data connector allowing to link it to OpenDD models and commands. It can be used to connect to various types of data connectors on different data sources, like SQL databases, NoSQL databases, REST APIs, GraphQL APIs, files, and more.

Metadata structure

Definition of a data connector, used to bring in sources of data and connect them to OpenDD models and commands.

KeyValueRequiredDescription
kindDataConnectorLinktrue
versionv1true
definitionDataConnectorLinkV1trueDefinition of a data connector - version 1.

Example:

kind: DataConnectorLink
version: v1
definition:
name: data_connector
url:
singleUrl:
value: http://data_connector:8100
headers: {}
schema:
version: v0.1
schema:
scalar_types: {}
object_types: {}
collections: []
functions: []
procedures: []
capabilities:
version: 0.1.3
capabilities:
query:
nested_fields: {}
variables: {}
mutation: {}

Definition of a data connector - version 1.

KeyValueRequiredDescription
nameDataConnectorNametrueThe name of the data connector.
urlDataConnectorUrlV1trueThe url(s) to access the data connector.
headersHttpHeadersfalseKey value map of HTTP headers to be sent with each request to the data connector. This is meant for protocol level use between engine and the data connector.
schemaSchemaAndCapabilitiesV01trueThe schema of the data connector. This schema is used as the source of truth when serving requests and the live schema of the data connector is not looked up.
argumentPresets[ArgumentPreset]falseArgument presets that applies to all functions and procedures of this data connector. Defaults to no argument presets.
responseHeadersResponseHeaders / nullfalseHTTP response headers configuration that is forwarded from a data connector to the client.

Configuration of what HTTP response headers should be forwarded from a data connector to the client in HTTP response.

KeyValueRequiredDescription
headersFieldstringtrueName of the field in the NDC function/procedure's result which contains the response headers
resultFieldstringtrueName of the field in the NDC function/procedure's result which contains the result
forwardHeaders[string]trueList of actual HTTP response headers from the data conector to be set as response headers

An argument preset that can be applied to all functions/procedures of a connector

KeyValueRequiredDescription
argumentArgumentNametrue
valueArgumentPresetValuetrue
KeyValueRequiredDescription
httpHeadersHttpHeadersPresettrueHTTP headers that can be preset from request

Configuration of what HTTP request headers should be forwarded to a data connector.

KeyValueRequiredDescription
forward[string]trueList of HTTP headers that should be forwarded from HTTP requests
additionalAdditionalHttpHeaderstrueAdditional headers that should be forwarded, from other contexts

Additional headers that should be forwarded, from other contexts

KeyValueRequiredDescription
<customKey>ValueExpressionfalse

An expression which evaluates to a value that can be used in permissions and various presets.

Must have exactly one of the following fields:

KeyValueRequiredDescription
literalfalse
sessionVariablestringfalseUsed to represent the name of a session variable, like "x-hasura-role".
booleanExpressionModelPredicatefalse

A predicate that can be used to restrict the objects returned when querying a model.

Must have exactly one of the following fields:

KeyValueRequiredDescription
fieldComparisonFieldComparisonPredicatefalseField comparison predicate filters objects based on a field value.
fieldIsNullFieldIsNullPredicatefalsePredicate to check if the given field is null.
relationshipRelationshipPredicatefalseRelationship predicate filters objects of a source model based on a predicate on the related model.
and[ModelPredicate]false
or[ModelPredicate]false
notModelPredicatefalse

Example:

fieldComparison:
field: author_id
operator: _eq
value:
sessionVariable: x-hasura-user-id

Relationship predicate filters objects of a source model based on a predicate on the related model.

KeyValueRequiredDescription
nameRelationshipNametrueThe name of the relationship of the object type of the model to follow.
predicateModelPredicate / nullfalseThe predicate to apply on the related objects. If this is null, then the predicate evaluates to true as long as there is at least one related object present.

The name of the GraphQL relationship field.

Value: string

Predicate to check if the given field is null.

KeyValueRequiredDescription
fieldFieldNametrueThe name of the field that should be checked for a null value.

Field comparison predicate filters objects based on a field value.

KeyValueRequiredDescription
fieldFieldNametrueThe field name of the object type of the model to compare.
operatorstringtrueThe name of the operator to use for comparison.
valueValueExpressiontrueThe value expression to compare against.

The name of a field in a user-defined object type.

Value: string

Value: string

The schema of the data connector. This schema is used as the source of truth when serving requests and the live schema of the data connector is not looked up.

KeyValueRequiredDescription
versionv0.1true
schemaSchema Responsetrue
capabilitiesCapabilities Responsetrue

Key value map of HTTP headers to be sent with an HTTP request. The key is the header name and the value is a potential reference to an environment variable.

KeyValueRequiredDescription
<customKey>EnvironmentValuefalseEither a literal string or a reference to a Hasura secret

The url(s) to access the data connector.

Must have exactly one of the following fields:

KeyValueRequiredDescription
singleUrlEnvironmentValuefalse
readWriteUrlsReadWriteUrlsfalse
KeyValueRequiredDescription
readEnvironmentValuetrue
writeEnvironmentValuetrue

Either a literal string or a reference to a Hasura secret

Must have exactly one of the following fields:

KeyValueRequiredDescription
valuestringfalse
valueFromEnvstringfalse

The name of a data connector.

Value: string

DataConnectorScalarRepresentation

The representation of a data connector scalar in terms of Open DD types

KeyValueRequiredDescription
kindDataConnectorScalarRepresentationtrue
versionv1true
definitionDataConnectorScalarRepresentationV1trueThe representation of a data connector scalar in terms of Open DD types

DataConnectorScalarRepresentationV1

The representation of a data connector scalar in terms of Open DD types

KeyValueRequiredDescription
dataConnectorNameDataConnectorNametrueThe name of the data connector that this scalar type comes from.
dataConnectorScalarTypestringtrueThe name of the scalar type coming from the data connector.
representationTypeNametrueThe name of the Open DD type that this data connector scalar type should be represented as.
graphqlDataConnectorScalarGraphQLConfiguration / nullfalseConfiguration for how this scalar's operators should appear in the GraphQL schema.

Example:

dataConnectorName: data_connector
dataConnectorScalarType: varchar
representation: String
graphql:
comparisonExpressionTypeName: String_Comparison_Exp

DataConnectorScalarGraphQLConfiguration

GraphQL configuration of a data connector scalar

KeyValueRequiredDescription
comparisonExpressionTypeNameGraphQlTypeName / nullfalse

GraphQlTypeName

Value: string

TypeName

The name of the Open DD type that this data connector scalar type should be represented as.

One of the following values:

ValueDescription
InbuiltTypeAn inbuilt primitive OpenDD type.
CustomTypeName

CustomTypeName

The name of a user-defined type.

Value: string

InbuiltType

An inbuilt primitive OpenDD type.

Value: ID / Int / Float / Boolean / String

DataConnectorName

The name of a data connector.

Value: string

Loading...