Ir para o conteúdo

Data Sources

Data sources are the tables, views and queries digna inspects. Create, read, update and delete them. Authentication, pagination and errors are described in the Overview.

Method Path Description
GET /v1/data-sources List data sources
POST /v1/data-sources Create a data source
GET /v1/data-sources/{data_source_id} Get a data source
PUT /v1/data-sources/{data_source_id} Update a data source
DELETE /v1/data-sources/{data_source_id} Delete a data source

List data sources

GET /v1/data-sources

Parameters

Name In Type Required Description
project_id query integer Yes Filter by project ID
limit query integer No Maximum number of rows to return (default: 200, max: 5000)

Responses

Status Description Body
200 List data sources array of DataSource
400 Invalid limit ApiError
401 Not authenticated ApiError
500 Internal error ApiError

Example

curl -X GET 'https://digna.example.com/v1/data-sources?project_id=<project_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Create a data source

POST /v1/data-sources

Request body: CreateDataSourceRequest

Responses

Status Description Body
201 Create a data source DataSource
401 Not authenticated ApiError
403 Not authorized ApiError
404 Not found ApiError
500 Internal error ApiError

Example

curl -X POST 'https://digna.example.com/v1/data-sources' \
  -H "Authorization: Bearer $DIGNA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "db_connection_id": 1,
    "kind": "TABLE",
    "modules": {
      "data_analytics": false,
      "data_anomaly": false,
      "data_validation": false,
      "schema_tracker": false,
      "timeliness": false
    },
    "name": "<name>",
    "object": {
      "catalog_name": "<catalog_name>",
      "schema_name": "<schema_name>",
      "table_name": "<table_name>"
    },
    "project_id": 1,
    "query_mode": "single",
    "report_empty_datasets": false,
    "snapshot_filter": "<snapshot_filter>",
    "snapshot_query": "<snapshot_query>"
  }'

Get a data source

GET /v1/data-sources/{data_source_id}

Parameters

Name In Type Required Description
data_source_id path integer Yes Data source ID

Responses

Status Description Body
200 Get a data source DataSource
401 Not authenticated ApiError
404 Data source not found ApiError
500 Internal error ApiError

Example

curl -X GET 'https://digna.example.com/v1/data-sources/<data_source_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Update a data source

PUT /v1/data-sources/{data_source_id}

Parameters

Name In Type Required Description
data_source_id path integer Yes Data source ID

Request body: UpdateDataSourceRequest

Responses

Status Description Body
200 Update a data source DataSource
401 Not authenticated ApiError
403 Not authorized ApiError
404 Data source not found ApiError
500 Internal error ApiError

Example

curl -X PUT 'https://digna.example.com/v1/data-sources/<data_source_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "db_connection_id": 1,
    "kind": "TABLE",
    "modules": {
      "data_analytics": false,
      "data_anomaly": false,
      "data_validation": false,
      "schema_tracker": false,
      "timeliness": false
    },
    "name": "<name>",
    "object": {
      "catalog_name": "<catalog_name>",
      "schema_name": "<schema_name>",
      "table_name": "<table_name>"
    },
    "query_mode": "single",
    "report_empty_datasets": false,
    "snapshot_filter": "<snapshot_filter>",
    "snapshot_query": "<snapshot_query>"
  }'

Delete a data source

DELETE /v1/data-sources/{data_source_id}

Parameters

Name In Type Required Description
data_source_id path integer Yes Data source ID

Responses

Status Description Body
204 Delete a data source —
401 Not authenticated ApiError
403 Not authorized ApiError
404 Data source not found ApiError
500 Internal error ApiError

Example

curl -X DELETE 'https://digna.example.com/v1/data-sources/<data_source_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Schemas

CreateDataSourceRequest

Field Type Required Description
db_connection_id integer Yes
description string, nullable No Business meaning of the data source. Defaults to an empty string.
kind StableDataSourceKind Yes
modules DataSourceModules Yes
name string Yes
object DataSourceObject Yes
project_id integer Yes
query_mode StableDataSourceQueryMode Yes
report_empty_datasets boolean Yes
snapshot_filter string Yes
snapshot_query string Yes

UpdateDataSourceRequest

Field Type Required Description
db_connection_id integer Yes
description string, nullable No Business meaning of the data source. Omit to keep the stored value.
kind StableDataSourceKind Yes
modules DataSourceModules Yes
name string Yes
object DataSourceObject Yes
query_mode StableDataSourceQueryMode Yes
report_empty_datasets boolean Yes
snapshot_filter string Yes
snapshot_query string Yes

ApiError

Field Type Required Description
code ApiErrorCode Yes
message string Yes

DataSource

Field Type Required Description
db_connection DataSourceDbConnection Yes
description string Yes Business meaning of the data source. Empty when none was given.
id integer Yes
kind StableDataSourceKind Yes
modules DataSourceModules Yes
name string Yes
object DataSourceObject Yes
project DataSourceProject Yes
query_mode StableDataSourceQueryMode Yes
report_empty_datasets boolean Yes
snapshot_filter string Yes
snapshot_query string Yes

StableDataSourceKind

One of: TABLE, QUERY, VIEW.

DataSourceModules

Field Type Required Description
data_analytics boolean Yes
data_anomaly boolean Yes
data_validation boolean Yes
schema_tracker boolean Yes
timeliness boolean Yes

DataSourceObject

Field Type Required Description
catalog_name string Yes
schema_name string Yes
table_name string Yes

StableDataSourceQueryMode

One of: single, combined.

ApiErrorCode

One of: INTERNAL_ERROR, INVALID_CREDENTIALS, NOT_FOUND, NOT_AUTHENTICATED, NOT_AUTHORIZED, INVALID_LICENSE, BAD_REQUEST.

DataSourceDbConnection

Field Type Required Description
id integer Yes
name string Yes

DataSourceProject

Field Type Required Description
id integer Yes
name string Yes