Skip to content

Databricks

The Databricks data provider allows ChartFactor to interact with Databricks.

To use the Databricks data provider you need include its library:

1
<script src="./cft-databricks-provider.min.js"></script>

The Provider JSON object requires a name, the provider type (e.g. 'databricks'), host, warehouse id, and token parameters. Example:

1
2
3
4
5
6
7
8
9
// define providers
var providers = [{
    name:'Databricks',
    provider:'databricks',
    host: 'DATABRICKS_HOST',
    warehouseId: 'DATABRICKS_WAREHOUSE_ID',
    token: 'DATABRICKS_TOKEN',
    metadata: {}
}]
Optionally, the configuration for Databricks allows to specify headers in case header elements need to be provided (e.g. User-Agent).

1
2
3
4
var providers = [{
    ...
    headers: { "User-Agent": "myapp/1.0.0"},
}]

Supported provider properties:

  • host: The Server Hostname value
  • warehouseId: The Databricks warehouse id value
  • token: The Databricks personal access token value
  • headers: The HTTP headers to be sent to the Databricks server, if the Authorization header is provided it will be overwritten by the token value
  • metadata: Please refer to the Custom Metadata section for a description on how to configure custom metadata

Finally, use the setProviders() method of ChartFactor to set your data provider definitions. Example:

1
cf.setProviders(providers);

Supported Aggregations Out-Of-The-Box

SUM

1
    var metric = cf.Metric("amount","sum");

AVG

1
    var metric = cf.Metric("amount","avg");

MIN

1
    var metric = cf.Metric("amount","min");

MAX

1
    var metric = cf.Metric("amount","max");

PERCENTILES

1
    var metric = cf.Metric('commission', 'percentiles');

COUNT DISTINCT

1
    var metric = cf.Metric("my_attribute","unique");

Dependencies

  • None