Create a MotherDuck Data Source

Follow these steps to connect to a MotherDuck database and create a MotherDuck data source.

Create a MotherDuck Data Source

Unlike most other data sources, you do not need to worry about setting up a user and their access rights, and can proceed to connect the database directly.

Steps:

  1. If you have not done so already, create a MotherDuck service token.

  2. On the home page switch to Data sources.

    The left navigation panel with the Data sources tab highlighted.
  3. Click Connect data.

    The Connect data button highlighted in the top-right corner of the Data sources screen.
  4. Select MotherDuck.

    Dialog showing available data source types with the MotherDuck option highlighted.
  5. Name your data source and fill in your MotherDuck credentials and click Connect:

    Form to enter credentials for a MotherDuck data source. Fields include the Data Source Name, Service Token, Database Name, and Schema.
  6. Click Save.

    Your data source is created!

    The list of data sources displaying the newly created GoodData ADS data source, including its name and unique ID.

Steps:

  1. If you have not done so already, create a MotherDuck service token.

  2. Encode your service token to Base64:

    # Linux
    echo -n $MOTHERDUCK_TOKEN | base64 -w 512
    # MacOS
    echo -n $MOTHERDUCK_TOKEN | base64
    
  3. Create a MotherDuck data source with the following API call:

    curl $HOST_URL/api/v1/entities/dataSources \
      -H "Content-Type: application/vnd.gooddata.api+json" \
      -H "Accept: application/vnd.gooddata.api+json" \
      -H "Authorization: Bearer $API_TOKEN" \
      -X POST \
      -d '{
        "data": {
          "type": "dataSource",
          "id": "<unique_id_for_the_data_source>",
          "attributes": {
            "name": "<data_source_display_name>",
            "type": "MOTHERDUCK",
            "url": "<MOTHERDUCK_JDBC_URL>",
            "token": "<ENCODED_MOTHERDUCK_TOKEN>",
            "username": "",
            "schema": "<MOTHERDUCK_SCHEMA>"
          }
        }
      }' | jq .
    

    where <MOTHERDUCK_JDBC_URL> may look like this: jdbc:duckdb:md:my_db_name.

  4. To confirm that the data source has been created, ensure the server returns the following response:

    {
      "data": {
        "attributes": {
          "name": "<data_source_display_name>",
          "type": "MOTHERDUCK",
          "url": "<MOTHERDUCK_JDBC_URL>",
          "username": "",
          "schema": "<MOTHERDUCK_SCHEMA>"
        },
        "id": "motherduck-datasource",
        "type": "dataSource"
      }
    }