Databases

These endpoints are specific to database connections.

Retrieve query schema

It executes the provided query on a source database connection and returns the result schema along with the first rows.

Request

  • :id

    int Required

    The ID of the source database connection on which the query will be executed.

  • query

    string Required

    The query to execute to read the result schema along with sample rows for reference. It must contain the "limit" placeholder and cannot be longer than 16,777,215 characters.

  • limit

    int

    The maximum number of rows to return along with the schema. The maximum is 100; the default is 0, meaning no rows are returned.

Response

  • schema

    nullable schema

    The schema of the query. It will be null if there are no supported columns.

  • rows

    array of object with json values

    The rows.

  • issues

    nullable array of string

    The issues encountered while reading the table, such as unsupported columns, which did not prevent processing. If it is not null, it contains at least one issue.

POST /v1/connections/:id/query
curl https://example.com/v1/connections/1371036433/query \
-H "Authorization: Bearer api_xxxxxxx" \
--json '{
"query": "SELECT name, email FROM users",
"limit": 50
}'
Response
{
  "schema": {
    "kind": "object",
    "properties": [
      {
        "name": "first_name",
        "type": {
          "kind": "string"
        },
        "nullable": true
      },
      {
        "name": "last_name",
        "type": {
          "kind": "string"
        },
        "nullable": true
      }
    ]
  },
  "rows": [
    {
      "first_name": "John",
      "last_name": "Mitchell"
    },
    {
      "first_name": "Emily",
      "last_name": "Carter"
    },
    {
      "first_name": "Michael",
      "last_name": "Reynolds"
    }
  ],
  "issues": [
    "Column \"mac_addr\" cannot be imported because its type \"MACADDR\" is not supported"
  ]
}
Errors
404
workspace does not exist
404
connection does not exist

Retrieve table schema

Returns the schema of a specified database table of a destination database connection.

Request

  • :id

    int Required

    The database destination connection where the table is located.

  • name

    string Required

    The name of the table.

Response

  • schema

    nullable schema

    The schema of the table. It will be null if there are no supported columns.

  • issues

    nullable array of string

    The issues encountered while reading the table, such as unsupported columns, which did not prevent processing. If it is not null, it contains at least one issue.

GET /v1/connections/:id/tables
curl -G https://example.com/v1/connections/1371036433/tables \
-H "Authorization: Bearer api_xxxxxxx" \
-d "name=users"
Response
{
  "schema": {
    "kind": "object",
    "properties": [
      {
        "name": "first_name",
        "type": {
          "kind": "string"
        },
        "nullable": true
      },
      {
        "name": "last_name",
        "type": {
          "kind": "string"
        },
        "nullable": true
      }
    ]
  },
  "issues": [
    "Column \"mac_addr\" cannot be imported because its type \"MACADDR\" is not supported"
  ]
}
Errors
404
workspace does not exist
404
connection does not exist