Skip to main content
Version: v3.x

Managing a Connector

Initializing a new connector

To initialize a new connector, run the following in a project directory:

ddn connector init <connector-name> --subgraph <subgraph.yaml> -i
ArgumentDescription
<connector-name>Whatever name you would like to assign to this connector.
<subgraph.yaml>Path to the config file of the subgraph to which the connector belongs.

You'll then need to choose the connector type and provide and env vars required by the connector, e.g. database connection urls.

This will set up the configuration for your connector in the subgraph's /connector directory.

Some connectors don't require any env vars

An example of this would be the Node.js Lambda TypeScript connector.

Running a connector locally

Each connector comes with a Docker Compose file which can be used to run the connector locally. By default, when a connector is added to a project, its Compose file is automatically added to the Compose file of the Engine to allow running the Engine and connector together.

To run a connector with the Engine:

In the project directory, run:
ddn run docker-start

This reads the docker-start script from the context config at .hasura/context.yaml and starts your Hasura engine and connectors.

To run a connector independently:

In the connector configuration directory, e.g. app/connector/my_connector, run:
docker compose -f compose.yaml --env-file <path-to-env-file-if-required> up

Introspecting the connector data source

If your connector has an upstream data source, e.g. a Postgres database for the hasura/postgres connector, you can update the connector configuration by introspecting the data source.

ddn connector introspect <connector-name> --subgraph <subgraph.yaml>
ArgumentDescription
<connector-name>Whatever name you would like to assign to this connector.
<subgraph.yaml>Path to the config file of the subgraph to which the connector belongs.

Deploying a connector to Hasura DDN

You can deploy any verified connector available on the Connector Hub to Hasura DDN using the CLI.

You can build and deploy your connector to Hasura DDN using the following command:

ddn connector build create --connector <connector.yaml> --project <project-name>
ArgumentDescription
<connector.yaml>Path to connector config file.
<project>DDN project to deploy to