Skip to content

MariaDB API

Audience: All Immuta Users

Content Summary: This page describes the mariadb endpoint.

Note

Additional fields may be included in some responses you receive; however, these attributes are for internal purposes and are therefore undocumented.

MariaDB Workflow

  1. Create a MariaDB data source.
  2. Search MariaDB data sources.
  3. Update MariaDB data sources.

Create a MariaDB Data Source

Endpoint

Method Path Purpose
POST /mariadb/handler Save the provided connection information as a data source.

Query Parameters

None.

Payload Parameters

Attribute Description Required
Private boolean When false, the data source will be publicly available in the Immuta UI. Yes
BlobHandler array[object] A list of full URLs providing the locations of all blob store handlers to use with this data source. Yes
BlobHandlerType string Describes the type of underlying blob handler that will be used with this data source (e.g., MS SQL). Yes
RecordFormat string The data format of blobs in the data source, such as json, xml, html, or jpeg. Yes
Type string The type of data source: ingested (metadata will exist in Immuta) or queryable (metadata is dynamically queried). Yes
Name string The name of the data source. It must be unique within the Immuta instance. Yes
SqlTableName string A string that represents this data source's table in the Query Engine. Yes
Organization string The organization that owns the data source. Yes
Category string The category of the data source. No
Description string The description of the data source. No
Owner array[object] Users and groups that should be added as owners to this data source. Profiles must be a list of profile IDs and groups must be a list of group IDs: { "profiles": [3, 5], "groups": [4, 1999] }. No
Expert array[object] Users and groups that should be added as expert users to this data source. Profiles must be a list of profile IDs and groups must be a list of group IDs: { "profiles": [87, 199], "groups": [324] }. No
Ingest array[object] Users and groups that should be added as ingest users to this data source. Profiles must be a list of profile IDs and groups must be a list of group IDs: { "profiles": [34, 23], "groups": [32] }. No
HasExamples boolean When true, the data source contains examples. No

Response Parameters

Attribute Description
Id integer The handler ID.
DataSourceId integer The ID of the data source.
Warnings string This message describes issues with the created data source, such as the data source being unhealthy.
ConnectionString string The connection string used to connect the data source to Immuta.

Request Example

The following request creates MariaDB data sources in Immuta.

curl \
    --request POST \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    --data @example-payload.json \
    https://your-immuta-url.com/mariadb/handler

Payload Example

{
  "handler": [{
    "metadata": {
      "ssl": true,
      "userFiles": [],
      "port": 3306,
      "hostname": "demo-database.example.com",
      "database": "public",
      "username": "John",
      "password": "your-password",
      "schemaProjectName": "Public",
      "staleDataTolerance": 86400,
      "bodataSchemaName": "public",
      "bodataTableName": "credit_accounts",
      "dataSourceName": "Public Credit Accounts",
      "table": "credit_accounts",
      "schema": "public"
    }
  }, {
    "metadata": {
      "ssl": true,
      "userFiles": [],
      "port": 3306,
      "hostname": "demo-database.example.com",
      "database": "public",
      "username": "John",
      "password": "your-password",
      "schemaProjectName": "Public",
      "staleDataTolerance": 86400,
      "bodataSchemaName": "public",
      "bodataTableName": "fake_medical_claims_2017",
      "dataSourceName": "Public Fake Medical Claims 2017",
      "table": "fake_medical_claims_2017",
      "schema": "public"
    }
  }],
  "dataSource": {
    "blobHandler": {
      "scheme": "https",
      "url": ""
    },
    "expiration": "2021-11-13T04:59:59.999Z",
    "blobHandlerType": "MariaDB",
    "recordFormat": "",
    "type": "queryable",
    "schemaEvolutionId": null,
    "columnEvolutionEnabled": true
  },
  "schemaEvolution": {
    "ownerProfileId": 1,
    "config": {
      "nameTemplate": {
        "nameFormat": "<Schema> <Tablename>",
        "tableFormat": "<tablename>",
        "sqlSchemaNameFormat": "<schema>",
        "schemaProjectNameFormat": "<Schema>"
      }
    },
    "schemas": []
  }
}

Response Example

{
  "connectionString": "john@demo-database.example.com:3306/public"
}

Search MariaDB Data Sources

Endpoint

Method Path Purpose
GET /mariadb/handler/{handlerId} Get the handler metadata associated with the provided handler ID.

Query Parameters

Attribute Description Required
HandlerId integer The specific handler ID. Yes
SkipCache boolean If true the handler cache will be skipped when retrieving the handler data. No

Response Parameters

Attribute Description
DataSourceId integer The data source ID.
Value metadata Details regarding the handler.

Request Example

The following request returns the handler metadata associated with the provided handler ID.

curl \
    --request GET \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://your-immuta-url.com/mariadb/handler/462

Response Example

{
  "dataSourceId": 462,
  "metadata": {
    "ssl": true,
    "port": 3306,
    "query": null,
    "table": "fake_medical_claims_2017",
    "schema": "public",
    "database": "public",
    "hostname": "mysql.demo-databases.immuta.com",
    "username": "immuta",
    "eventTime": "date_of_service",
    "dataSourceName": "Public Fake Medical Claims 2017",
    "bodataTableName": "fake_medical_claims_2017",
    "disableClassify": false,
    "highCardinality": "visit_id",
    "bodataSchemaName": "public",
    "columnsNormalized": false,
    "schemaProjectName": "Public",
    "staleDataTolerance": 2592000,
    "connectionStringOptions": null
  },
  "type": "odbcHandler",
  "connectionString": "immuta@mysql.demo-databases.immuta.com:3306/public",
  "remoteTableDescription": "[{\"name\":\"visit_id\",\"dataType\":\"int(11)\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"date_of_service\",\"dataType\":\"datetime\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"ssn\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"first_name\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"last_name\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"dob\",\"dataType\":\"datetime\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"gender\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"city\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"state\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"icd10_diag_code\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"claim_amount\",\"dataType\":\"double\",\"isPrimaryKey\":null,\"nullable\":\"YES\"}]",
  "id": 462,
  "createdAt": "2021-09-23T17:40:26.158Z",
  "updatedAt": "2021-09-23T17:40:27.217Z",
  "dbms": {
    "name": "mariadb"
  }
}

Update MariaDB Data Sources

Method Path Purpose
PUT /mariadb/handler/{handlerId} Update the data source metadata associated with the provided handler ID. This endpoint does not perform partial updates, but will allow the dictionary to be omitted. In this case, it uses the current dictionary.
PUT /mariadb/bulk Update the data source metadata associated with the provided connection string.
PUT /mariadb/handler/{handlerId}/triggerHighCardinalityJob Recalculate the high cardinality column for the specified data source.

Update Handler Metadata

Endpoint

Method Path Purpose
PUT /mariadb/handler/{handlerId} Update the handler metadata associated with the provided handler ID. This endpoint does not perform partial updates, but will allow the dictionary to be omitted. In this case, it uses the current dictionary.

Query Parameters

Attribute Description Required
HandlerID integer The ID of the handler. Yes
SkipCache boolean When true, will skip the handler cache when retrieving metadata. No

Payload Parameters

Attribute Description Required
Handler metadata Includes metadata about the handler, such as ssl, port, database, hostname, username, and password. Yes
ConnectionString string The connection string used to connect to the data source. Yes

Response Parameters

Attribute Description
Id integer The ID of the handler.
Ca string The certificate authority.
Columns array[object] This is a Data Dictionary object, which provides metadata about the columns in the data source, including the name and data type of the column.

Request Example

The following request returns the handler metadata associated with the provided handler ID.

curl \
    --request PUT \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    --data @example-payload.json \
    https://your-immuta-url.com/mariadb/handler/46
Payload Example

The payload below updates the dataSourceName to Medical Claims 2021.

{
  "handler": {
    "policyHandler": {
      "handlerId": 57,
      "visibilitySchema": {
        "fields": [],
        "version": "2021-10-05T19:35:43.905Z"
      },
      "previousHandlerId": 54,
      "dataSourceId": 47
    },
    "dataSourceId": 47,
    "metadata": {
      "ssl": true,
      "port": 3306,
      "table": "fake_medical_claims_2017",
      "schema": "public",
      "database": "public",
      "hostname": "demo-database.example.com",
      "username": "John",
      "eventTime": "date_of_service",
      "userFiles": [],
      "dataSourceName": "Medical Claims 2021",
      "bodataTableName": "fake__medical_claims_2017",
      "highCardinality": "visit_id",
      "bodataSchemaName": "public",
      "columnsNormalized": false,
      "schemaProjectName": "Public",
      "staleDataTolerance": 86400,
      "columns": [{
        "name": "visit_id",
        "dataType": "integer",
        "remoteType": "int(11)",
        "nullable": true
      }, {
        "name": "date_of_service",
        "dataType": "timestamp",
        "remoteType": "datetime",
        "nullable": true
      }, {
        "name": "ssn",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "first_name",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "last_name",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "dob",
        "dataType": "timestamp",
        "remoteType": "datetime",
        "nullable": true
      }, {
        "name": "gender",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "city",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "state",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "icd10_diag_code",
        "dataType": "text",
        "remoteType": "text",
        "nullable": true
      }, {
        "name": "claim_amount",
        "dataType": "double precision",
        "remoteType": "double",
        "nullable": true
      }],
      "password": "your-password"
    },
    "type": "odbcHandler",
    "connectionString": "john@demo-database.example.com:3306/public",
    "remoteTableDescription": "[{\"name\":\"visit_id\",\"dataType\":\"int(11)\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"date_of_service\",\"dataType\":\"datetime\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"ssn\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"first_name\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"last_name\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"dob\",\"dataType\":\"datetime\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"gender\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"city\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"state\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"icd10_diag_code\",\"dataType\":\"text\",\"isPrimaryKey\":null,\"nullable\":\"YES\"},{\"name\":\"claim_amount\",\"dataType\":\"double\",\"isPrimaryKey\":null,\"nullable\":\"YES\"}]",
    "id": 46,
    "createdAt": "2021-10-01T22:16:37.459Z",
    "updatedAt": "2021-10-01T22:16:38.420Z",
    "dbms": {
      "name": "mariadb"
    }
  }
}

Response Example

{
  "id": 46,
  "ca": ["-----BEGIN CERTIFICATE-----\ncertificate-data\n-----END CERTIFICATE-----"],
  "metadata": {
    "columns": [{
      "name": "visit_id",
      "dataType": "integer",
      "remoteType": "int(11)",
      "nullable": true
    }, {
      "name": "date_of_service",
      "dataType": "timestamp",
      "remoteType": "datetime",
      "nullable": true
    }, {
      "name": "ssn",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "first_name",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "last_name",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "dob",
      "dataType": "timestamp",
      "remoteType": "datetime",
      "nullable": true
    }, {
      "name": "gender",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "city",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "state",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "icd10_diag_code",
      "dataType": "text",
      "remoteType": "text",
      "nullable": true
    }, {
      "name": "claim_amount",
      "dataType": "double precision",
      "remoteType": "double",
      "nullable": true
    }]
  }
}

Update Handler Metadata by Handler ID

Endpoint

Method Path Purpose
PUT /mariadb/bulk Update the handler metadata associated with the provided handler ID.

Query Parameters

None.

Payload Parameters

Attribute Description Required
Handler metadata Includes metadata about the handler, such as ssl, port, database, hostname, username, and password. Yes
ConnectionString string The connection string used to connect to the data sources. Yes

Response Parameters

Attribute Description
BulkId string The ID of the bulk data source update.
ConnectionString string The connection string shared by the data sources bulk updated.
JobsCreated integer The number of jobs that ran to update the data sources; this number corresponds to the number of data sources updated.

Request Example

This request updates the metadata for all data sources with the connection string specified in example-payload.json.

curl \
    --request PUT \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    --data @example-payload.json \
    https://your-immuta-url.com/mariadb/bulk
Payload Example

The payload below adds a certificate (certificate.json) to connect to the data sources with the provided connection.

{
  "handler": {
    "metadata": {
      "ssl": true,
      "port": 3306,
      "database": "public",
      "hostname": "demo-database.example.com",
      "username": "John",
      "userFiles": [{
        "keyName": "testcert",
        "filename": "75b4ca754963b8893b9c3354aa7175e1c87a9be3.json",
        "userFilename": "certificate.json"
      }],
      "password": "your-password"
    }
  },
  "connectionString": "demo-database.example.com:3306/public/public"
}

Response Example

{
  "bulkId": "bulk_ds_update_3edd728673e94d9992824c9d9dea8f60",
  "connectionString": "john@demo-database.example.com:3306/public",
  "jobsCreated": 6
}

Recalculate a High Cardinality Column

Endpoint

Method Path Purpose
PUT /mariadb/handler/{handlerId}/triggerHighCardinalityJob Recalculate the high cardinality column for the provided handler ID.

Query Parameters

Attribute Description Required
HandlerId integer The specific handler ID. Yes

Response Parameters

The response returns a string of characters that identify the high cardinality job run.

Request Example

The following request recalculates the high cardinality column for the provided handler ID.

curl \
    --request PUT \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer dea464c07bd07300095caa8" \
    https://your-immuta-url.com/mariadb/handler/462/triggerHighCardinalityJob

Response Example

  bfb136d0-1ca0-11ec-89f0-c915a3f093e2