Databricks
The Databricks data provider allows ChartFactor to interact with Databricks.
To use the Databricks data provider you need include its library:
| <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:
| // 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).
| 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:
| cf.setProviders(providers);
|
Supported Aggregations Out-Of-The-Box
SUM
| var metric = cf.Metric("amount","sum");
|
AVG
| var metric = cf.Metric("amount","avg");
|
MIN
| var metric = cf.Metric("amount","min");
|
MAX
| var metric = cf.Metric("amount","max");
|
PERCENTILES
| var metric = cf.Metric('commission', 'percentiles');
|
COUNT DISTINCT
| var metric = cf.Metric("my_attribute","unique");
|
Dependencies