Management

Data Sources

The Data Source resource helps you manage databases connected to your Mode organization. Mode supports most popular relational databases, and you can connect as many private databases as you like.

Learn more about managing user permissions for a data source.

Data Source object

Properties

id

required

integer

name

required

string

description

required

string

token

required

string

adapter

required

string

enum: jdbc:hive jdbc:impala jdbc:mysql jdbc:oracle jdbc:postgresql jdbc:redshift jdbc:sqlserver jdbc:vertica jdbc:presto jdbc:treasuredata jdbc:bigquery jdbc:athena jdbc:snowflake jdbc:teradata jdbc:db2

created_at

required

string

updated_at

required

string

has_expensive_schema_updates

required

boolean

public

required

boolean

asleep

required

boolean

queryable

required

boolean

display_name

required

string

account_id

integer

account_username

string

organization_token

string

default

boolean

default_for_organization_id

boolean

database

string

host

string

port

string

ssl

boolean

username

string

provider

string

vendor

string

ldap

boolean

warehouse

string

bridged

boolean

adapter_version

string

custom_attributes

required

object

_links

required

object

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
  • data_source_grants
  • 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 organization, send a GET request to the data_sources resource with a data_source token.

URL Params

organization

required
string Organization username

data_source

required
string DataSource token
Responses

200

DataSource response

401

Unauthorized

404

DataSource not found

GET /{organization}/data_sources/{data_source}

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{organization}/data_sources/{data_source}'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://modeanalytics.com/api/{organization}/data_sources/{data_source}')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{organization}/data_sources/{data_source}', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'GET',
  url: 'https://modeanalytics.com/api/{organization}/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 organization, send a GET request to the data_sources resource.

URL Params

organization

required
string Organization username
Responses

200

DataSource collection response

401

Unauthorized

404

Organization not found

GET /{organization}/data_sources

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{organization}/data_sources'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://modeanalytics.com/api/{organization}/data_sources')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{organization}/data_sources', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'GET',
  url: 'https://modeanalytics.com/api/{organization}/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 (Organization or User) username

data_source

required
string DataSource token
Responses

200

DataSourceSchemaUpdate response

400

Bad request

401

Unauthorized

404

DataSource not found

POST /{account}/data_sources/{data_source}/schema_updates

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/data_sources/{data_source}/schema_updates'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .post('https://modeanalytics.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://modeanalytics.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://modeanalytics.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);
});