Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Datastores

Datastores define a destination for data loaded into a workspace by pipelines. The default datastore for a workspace is its own PostgreSQL database hosted by Matatika, but this can be changed at any time to another datastore with your own credentials (see our supported dataplugins of type LOADER).


Objects

Datastore

Path Type Format Description
id String Version 4 UUID The datastore ID
created String ISO 8601 timestamp The instant at which the datastore was created
lastModified String ISO 8601 timestamp The instant at which the datastore was last modified
name String   The datastore name
dataPlugin String   Create / update with dataplugin fullyQualifiedName
workspace String Version 4 UUID The datastore workspace id
jdbcUrl String JDBC URL The datastore JDBC URL
properties Properties   The datastore properties

Properties

For each setting s in the dataplugin settings:

Path Type Description
s.name s.kind Refer to s.description

Requests


View all datastores in a workspace

GET

/api/workspaces/{workspace-id}/datastores

Returns the datastores in the workspace {workspace-id}.

Prerequisites

  • Workspace {workspace-id} must exist

Request

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores' -i -X GET \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/json'

Python (requests)

import requests

url = "https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores"

headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("GET", url, headers=headers)

print(response.text.encode('utf8'))

Response

200 OK

Datastore collection with HAL links.

{
  "_embedded" : {
    "datastores" : [ {
      "id" : "5a0f5dc6-a8b8-47a7-b899-7a2c0523b5f6",
      "created" : "2024-10-24T15:15:28.048934",
      "lastModified" : "2024-10-24T15:15:28.048935",
      "name" : "Warehouse",
      "properties" : {
        "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
        "dbname" : "yxpethm",
        "default_target_schema" : "analytics",
        "port" : "5432",
        "host" : "sharp-banana.postgres.database.azure.com",
        "user" : "yxpethm"
      },
      "commands" : { },
      "dataPlugin" : "loaders/target-postgres--matatika",
      "logoUrl" : "/assets/logos/loaders/postgres.png",
      "workspace" : "395d3d23-899f-4eba-90c6-c10790a8875e",
      "jdbcUrl" : "jdbc:postgresql://sharp-banana.postgres.database.azure.com:5432/yxpethm",
      "sqlAlchemyUrl" : "postgresql://yxpethm:3v9AfqWT_c2TH5oTq_S4wBLo6d@sharp-banana.postgres.database.azure.com:5432/yxpethm?options=-csearch_path%3Dpublic",
      "managed" : true,
      "draft" : false,
      "_links" : {
        "self" : {
          "href" : "https://app.matatika.com/api/datastores/5a0f5dc6-a8b8-47a7-b899-7a2c0523b5f6"
        },
        "dataplugin" : {
          "href" : "https://app.matatika.com/api/dataplugins/0735434e-f245-478e-8191-d967c86755be"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}

View a datastore

GET

/api/datastores/{datastore-id}

Returns the datastore {datastore-id}.

Prerequisites

  • Datastore {datastore-id} must exist

Request

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c' -i -X GET \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/json'

Python (requests)

import requests

url = "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"

headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("GET", url, headers=headers)

print(response.text.encode('utf8'))

Response

200 OK

Datastore with HAL links.

{
  "id" : "230c78b1-fafb-4265-82ca-15f46c3a929c",
  "created" : "2024-10-24T15:15:34.245199",
  "lastModified" : "2024-10-24T15:15:35.657621",
  "name" : "Test datastore (updated)",
  "properties" : {
    "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
    "default_target_schema" : "analytics",
    "dbname" : "yxpethm",
    "host" : "sharp-banana.postgres.database.azure.com",
    "user" : "yxpethm"
  },
  "commands" : { },
  "dataPlugin" : "loaders/target-postgres--matatika",
  "logoUrl" : "/assets/logos/loaders/postgres.png",
  "workspace" : "395d3d23-899f-4eba-90c6-c10790a8875e",
  "jdbcUrl" : "jdbc:postgresql://sharp-banana.postgres.database.azure.com:5432/yxpethm",
  "sqlAlchemyUrl" : "postgresql://yxpethm:3v9AfqWT_c2TH5oTq_S4wBLo6d@sharp-banana.postgres.database.azure.com:5432/yxpethm?options=-csearch_path%3Dpublic",
  "managed" : false,
  "draft" : false,
  "_links" : {
    "self" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "update datastore" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "delete datastore" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "make-default" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c/default"
    },
    "dataplugin" : {
      "href" : "https://app.matatika.com/api/dataplugins/0735434e-f245-478e-8191-d967c86755be"
    }
  }
}

Set a datastore as the workspace default

PUT

/api/datastores/{datastore-id}/default

Sets the datastore {datastore-id} as the workspace default.

Prerequisites

  • Datastore {datastore-id} must exist

Request

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c/default' -i -X PUT \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/json'

Python (requests)

import requests

url = "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c/default"

headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("PUT", url, headers=headers)

print(response.text.encode('utf8'))

Response

200 OK

No response body provided.


Initialise a new datastore in a workspace

POST

/api/workspaces/{workspace-id}/datastores

Initialises a new datastore in the workspace {workspace-id}.

Prerequisites

  • Workspace {workspace-id} must exist

Request

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores' -i -X POST \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/json'

Python (requests)

import requests

url = "https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores"

headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("POST", url, headers=headers)

print(response.text.encode('utf8'))

Response

200 OK

Datastore with HAL links.

{
  "id" : "230c78b1-fafb-4265-82ca-15f46c3a929c",
  "created" : "2024-10-24T15:15:34.038707582",
  "lastModified" : "2024-10-24T15:15:34.038708482",
  "properties" : { },
  "commands" : { },
  "workspace" : "395d3d23-899f-4eba-90c6-c10790a8875e",
  "managed" : false,
  "draft" : false,
  "_links" : {
    "self" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "create datastore" : {
      "href" : "https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    }
  }
}

Create or update a datastore in a workspace

PUT

/api/workspaces/{workspace-id}/datastores/{datastore-id}

Creates or updates the datastore {datastore-id} in the workspace {workspace-id}.

Prerequisites

  • Workspace {workspace-id} must exist

Request

Body

Datastore resource.

{
  "name" : "Test datastore",
  "dataPlugin" : "loaders/target-postgres",
  "properties" : {
    "default_target_schema" : "analytics",
    "dbname" : "yxpethm",
    "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
    "host" : "sharp-banana.postgres.database.azure.com",
    "user" : "yxpethm"
  }
}

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c' -i -X PUT \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/hal+json; charset=ISO-8859-1' \
    -d '{
  "name" : "Test datastore",
  "dataPlugin" : "loaders/target-postgres",
  "properties" : {
    "default_target_schema" : "analytics",
    "dbname" : "yxpethm",
    "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
    "host" : "sharp-banana.postgres.database.azure.com",
    "user" : "yxpethm"
  }
}'

Python (requests)

import requests

url = "https://app.matatika.com/api/workspaces/395d3d23-899f-4eba-90c6-c10790a8875e/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"

data = {
  "name" : "Test datastore",
  "dataPlugin" : "loaders/target-postgres",
  "properties" : {
    "default_target_schema" : "analytics",
    "dbname" : "yxpethm",
    "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
    "host" : "sharp-banana.postgres.database.azure.com",
    "user" : "yxpethm"
  }
}
headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("PUT", url, headers=headers, data=data)

print(response.text.encode('utf8'))

Response

200 OK / 201 Created

Datastore with HAL links.

{
  "id" : "230c78b1-fafb-4265-82ca-15f46c3a929c",
  "created" : "2024-10-24T15:15:34.24519904",
  "lastModified" : "2024-10-24T15:15:34.24520004",
  "name" : "Test datastore",
  "properties" : {
    "default_target_schema" : "analytics",
    "dbname" : "yxpethm",
    "password" : "3v9AfqWT_c2TH5oTq_S4wBLo6d",
    "host" : "sharp-banana.postgres.database.azure.com",
    "user" : "yxpethm"
  },
  "commands" : { },
  "dataPlugin" : "loaders/target-postgres--matatika",
  "logoUrl" : "/assets/logos/loaders/postgres.png",
  "workspace" : "395d3d23-899f-4eba-90c6-c10790a8875e",
  "jdbcUrl" : "jdbc:postgresql://sharp-banana.postgres.database.azure.com:5432/yxpethm",
  "sqlAlchemyUrl" : "postgresql://yxpethm:3v9AfqWT_c2TH5oTq_S4wBLo6d@sharp-banana.postgres.database.azure.com:5432/yxpethm?options=-csearch_path%3Dpublic",
  "managed" : false,
  "draft" : false,
  "_links" : {
    "self" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "update datastore" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "delete datastore" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"
    },
    "make-default" : {
      "href" : "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c/default"
    },
    "dataplugin" : {
      "href" : "https://app.matatika.com/api/dataplugins/0735434e-f245-478e-8191-d967c86755be"
    }
  }
}

Delete a datastore

DELETE

/api/datastores/{datastore-id}

Deletes the datastore {datastore-id}.

Prerequisites

  • Datastore {datastore-id} must exist

Request

Example Snippets

cURL

curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c' -i -X DELETE \
    -H 'Accept: application/json, application/javascript, text/javascript, text/json' \
    -H 'Content-Type: application/json'

Python (requests)

import requests

url = "https://app.matatika.com/api/datastores/230c78b1-fafb-4265-82ca-15f46c3a929c"

headers = {
  'Authorization': ACCESS_TOKEN
}

response = requests.request("DELETE", url, headers=headers)

print(response.text.encode('utf8'))

Response

204 No Content

No response body provided.