Management
Data Sources
The Data Source resource helps you manage databases connected to your Mode Workspace. Mode supports most popular relational databases, and you can connect as many private databases as you like.
Data Source object
Properties | |
id required |
integer |
name required |
string |
description required |
string |
token required |
string |
adapter required |
string enum: jdbc:athena jdbc:bigquery jdbc:databricks jdbc:dbtmetrics jdbc:denodo jdbc:druid jdbc:hive jdbc:impala jdbc:mysql jdbc:oracle jdbc:oracleadb jdbc:postgresql jdbc:trino jdbc:presto jdbc:clickhouse jdbc:redshift jdbc:snowflake jdbc:spark jdbc:sqlserver jdbc:treasuredata jdbc:vertica jdbc:salesforce jdbc:dbtsemanticlayer jdbc:looker jdbc:arrowflightsql jdbc:modedatasets |
created_at required |
string |
updated_at required |
string |
has_expensive_schema_updates required |
boolean |
public required |
boolean |
asleep required |
boolean |
queryable required |
boolean |
soft_deleted required |
boolean |
display_name required |
string |
account_id |
integer |
account_username |
string |
organization_token |
string |
organization_plan_code |
string |
database required |
string |
host required |
string |
port required |
string |
ssl required |
boolean |
username required |
string |
provider required |
string |
vendor required |
string |
ldap required |
boolean |
warehouse required |
string |
bridged required |
boolean |
adapter_version required |
string |
custom_attributes required |
object |
ssl_trusted_cert |
string |
default_access_level |
string |
_links required |
object |
Links
All resource responses contain a set of links that describe other
related resources or actions that you can take on this resource.
A link is comprised of two main pieces:
its name (which describes its relationship to this resource)
and its href (the URL of the related action or resource).
All resources have at least a _self
link which is the URL
that will return a representation of this resource.
- account
- creator
- permissions
- self
- web
- web_home
{
"id": 19906113,
"name": "exercitation",
"description": "ut quis Duis",
"token": "fghrnyjuk8ter",
"adapter": "jdbc:oracle",
"created_at": "YYYY-MM-DDTHH:MM:SS.msZ",
"updated_at": "YYYY-MM-DDTHH:MM:SS.msZ",
"has_expensive_schema_updates": true,
"public": false,
"asleep": true,
"queryable": false,
"display_name": "ea",
"custom_attributes": {
"standard_sql": false
},
"account_id": 50560901,
"account_username": "nostrud in",
"organization_token": "fdeg345hbtn",
"default": true,
"default_for_organization_id": true,
"database": "minim anim cupidatat ex",
"host": "sint",
"port": "tempor veniam aliquip magna Excepte",
"ssl": true,
"username": "commodo",
"provider": "cillum ea",
"vendor": "proident incididunt nisi",
"ldap": true,
"warehouse": "fugiat quis Lorem",
"bridged": true,
"adapter_version": "nisi sunt veniam",
"_links": {
"self": {
"href": "sunt",
"templated": false
},
"account": {
"href": "Excepteur",
"templated": false
},
"web": {
"href": "laborum do occaecat dolor",
"templated": false
},
"web_home": {
"href": "magna aliqua incididunt laborum exercitation",
"templated": false
},
"data_source_grants": {
"href": "do magna aliqua qui pariatur",
"templated": false
}
},
"_embedded": {}
}
Get a data source
To retrieve information about a specific data source connected to your Mode Workspace, send a GET request to the data_sources
resource with a data_source
token.
URL Params | ||
workspace required |
string |
Workspace username
|
data_source required |
string |
DataSource token
|
Responses | |
200 |
DataSource response |
401 |
Unauthorized |
404 |
DataSource not found |
GET
/{workspace}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{workspace}/data_sources/{data_source}'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.get('https://app.mode.com/api/{workspace}/data_sources/{data_source}')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/data_sources/{data_source}', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{workspace}/data_sources/{data_source}',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
List data sources
To retrieve a list of all data sources connected to your Mode Workspace, send a GET request to the data_sources
resource.
URL Params | ||
workspace required |
string |
Workspace username
|
Responses | |
200 |
DataSource collection response |
401 |
Unauthorized |
404 |
Workspace not found |
GET
/{workspace}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{workspace}/data_sources'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.get('https://app.mode.com/api/{workspace}/data_sources')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/data_sources', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{workspace}/data_sources',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Update data source schema
To update a data source schema, send a POST request including the account username and the corresponding data source token.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
data_source required |
string |
DataSource token
|
Responses | |
200 |
DataSourceSchemaUpdate response |
400 |
Bad request |
401 |
Unauthorized |
404 |
DataSource not found |
POST
/{account}
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/data_sources/{data_source}/schema_updates'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.post('https://app.mode.com/api/{account}/data_sources/{data_source}/schema_updates')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/data_sources/{data_source}/schema_updates', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'POST',
url: 'https://app.mode.com/api/{account}/data_sources/{data_source}/schema_updates',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Update a data source
To update a data source, send a PATCH request including the account username and the corresponding data source token.
Additional Notes:
To update Oracle Autonomous Database credentials send the new wallet file if the data source does not use bridge. The password must be resubmitted along with the request. If you’ve connected Oracle Autonomous Database via bridge, you will be required to submit the connection string and password.
To update Vertica credentials send the new certificate file.
To update BigQuery credentials send the new key file.
URL Params | ||
workspace required |
string |
Workspace username
|
data_source required |
string |
DataSource token
|
POST Body Params
Object: |
||
name |
string |
Name of the data source
Example:
|
description |
string |
Description of the data source
Example:
|
password |
string |
Password for the data source
Example:
|
custom_attributes |
object | For Oracle Autonomous Database connected via bridge, pass the connection string as a custom attribute |
certificate |
file | |
key |
file | |
wallet |
file |
Responses | |
200 |
DataSource response |
400 |
Bad request |
401 |
Unauthorized |
404 |
DataSource not found |
PATCH
/{workspace}
curl --include \
--request PATCH \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
--data-binary "{
\"data_source\": {
\"name\": \"Updated name\",
\"description\": \"Updated description\",
\"password\": \"db_password\",
\"custom_attributes\": {
\"connection_string\": \"needed only for bridged Oracle Autonomous Database\"
}
}
}" \
'https://app.mode.com/api/{workspace}/data_sources/{data_source}'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
values = {
data_source: {
name: 'Updated name',
description: 'Updated description',
password: 'db_password',
custom_attributes: {
connection_string: 'needed only for bridged Oracle Autonomous Database'
}
}
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.patch('https://app.mode.com/api/{workspace}/data_sources/{data_source}', json: values)
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
values = """
{
"data_source": {
"name": "Updated name",
"description": "Updated description",
"password": "db_password",
"custom_attributes": {
"connection_string": "needed only for bridged Oracle Autonomous Database"
}
}
}
"""
request = Request('https://app.mode.com/api/{workspace}/data_sources/{data_source}', data=values, headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'PATCH',
url: 'https://app.mode.com/api/{workspace}/data_sources/{data_source}',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
},
body: "{ \"data_source\": { \"name\": \"Updated name\", \"description\": \"Updated description\", \"password\": \"db_password\", \"custom_attributes\": { \"connection_string\": \"needed only for bridged Oracle Autonomous Database\" } }}"
}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Purge report results
This POST request will purge all report
results that use the specified data_source
. It will not remove the report
resources. When viewing a report that has been purged, an error will display until the report is run again. This action is irreversible.
URL Params | ||
workspace required |
string |
Workspace username
|
data_source required |
string |
DataSource token
|
Responses | |
202 |
Accepted |
400 |
Bad request |
401 |
Unauthorized |
404 |
DataSource not found |
POST
/{workspace}
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{workspace}/data_sources/{data_source}/purge'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.post('https://app.mode.com/api/{workspace}/data_sources/{data_source}/purge')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/data_sources/{data_source}/purge', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'POST',
url: 'https://app.mode.com/api/{workspace}/data_sources/{data_source}/purge',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});