All Connectors
SingleStore Data Connector
SingleStore Data Connector
SingleStore Data Connector
The Hasura SingleStore Connector enables you to connect to a SingleStore database and gives instant access to a GraphQL API on top of your data.
About
Version
Released
September 2, 2024
Last Updated
September 4, 2024
GitHub Repo

SingleStore Data Connector

Docs ndc-hub License Status

The Hasura SingleStore Connector ("the connector") enables you to connect to a SingleStore database and gives instant access to a GraphQL API on top of your data.

This connector is built using the Typescript Data Connector SDK and, it implements the Data Connector Spec.

Features

The following matrix lists the features supported by the Hasura SingleStore connector:

FeatureSupportedNotes
Native Queries + Logical Models
Simple Object Query
Filter / Search
Simple Aggregation
Sort
Paginate
Table Relationships
Views
Distinct
Remote Relationships
Mutationscoming soon

Prerequisites

Ensure that the following prerequisites are met before using the connector:

  1. Install DDN CLI and Docker.
  2. Initialize a supergraph.
  3. Initialize a subgraph.
  4. An active SingleStore deployment that serves as the data source for the API.

Using the SingleStore connector

The following steps explain how to initialize and configure the connector for local development. For information on deploying a connector after it has been configured, refer to Deploy a Connector.

Step 1: Authenticate your CLI session

ddn auth login

Step 2: Configure the connector

After the supergraph and subgraph have been initialized (refer to Prerequisites, run the initialization command in interactive mode. Specify a name for the connector in the command.

ddn connector init <connector-name>  -i

Step 2.1: Select the SingleStore connector

From the list of connectors, select singlestore.

Step 2.2: Select a port for the connector

The CLI prompts you to specify a port for running the connector. Either select the default port suggested or choose a port that is not currently in use.

Step 2.3: Provide the environment variable(s) for the connector

Specify the connection string used to connect to the SingleStore database using the SINGLESTORE_URL variable. The connection string must be in the

mysql://[<username>[:<password>]][@<host>:[<port>]]/[<database>][?<key1>=<value1>[&<key2>=<value2>]]
format.

For example:

SINGLESTORE_URL=singlestore://username:password@hostname/database

The connector uses MySQL2 library to establish a connection. For more information, refer to Connection options and Pool options.

Alternatively, you can also set following environment variables instead of the SINGLELSTORE_URL variable:

NameDefaultDescription
SINGLESTORE_HOSTlocalhostHostname of the SingleStore database to connect with.
SINGLESTORE_PORT3306Port number of the SingleStore database.
SINGLESTORE_PASSWORDPassword of the SingleStore database user.
SINGLESTORE_DATABASEName of the SingleStore database to connect with.
SINGLESTORE_SSL_CAPath to the trusted CA certificate file.
SINGLESTORE_SSL_CERTPath to the certificate chain file in PEM format.
SINGLESTORE_SSL_KEYPath to the private key file in PEM format.
SINGLESTORE_SSL_CIPHERSCipher suite specification. If specified, it replaces the default value.
SINGLESTORE_SSL_PASSPHRASECipher suite specification. If specified, it replaces the default value.
SINGLESTORE_SSL_REJECT_UNAUTHORIZEDtrueIf enabled, the server rejects any connection that is not authorized with the list of supplied CAs.

If SINGLELSTORE_URL is set these variables are ignored.

Step 3: Introspect your data source

After configuring the connector, use the CLI to introspect the SingleStore database and create a source-specific configuration file for the connector (configuration.json).

ddn connector introspect <connector-name>

Step 4: Add your resources

This command will create .hml files for each table and view in your database and an .hml file with information about SingleStore data types.

ddn connector-link add-resources <connector-name>

Step 5. Add relationships

SingleStore does not support foreign keys. Relationships between tables must be added manually. You can define relationships by appending relationship information to the .hml files generated in the previous step. For information on defining relationships, refer to Relationships. For example, to add a relationship from a message table to the user table, append following text to the DbMessage.hml file:

---
kind: Relationship
version: v1
definition:
  name: user
  sourceType: DbMessage
  target:
    model:
      name: DbUser
      subgraph: app
      relationshipType: Object
  mapping:
    - source:
        fieldPath:
          - fieldName: userId
      target:
        modelField:
          - fieldName: id
  description: The user details for a message

License

The SingleStore connector is available under the Apache License 2.0.

2024 Edition

The GraphQL Handbook

A GraphQL Handbook for developers and architects to help plan your GraphQL adoption journey.
The GraphQL Handbook

Ship a rock-solid API on your data – in minutes!