Einstein Analytics (previously known as Wave Analytics) allows developers to not only create analytics applications, but also to create application templates that allow end-users to create their own analytics applications based on your master app. You, the developer, can define parameters and rules as part of the template, allowing the end-user to customize the app to their requirements. This Dreamforce 2017 session explains how to use Analytics Templates and the Analytics External Data API to automate the ingest of data from outside the platform, manipulating datasets and dataflows to provide a seamless experience for the user.
1. Integrating with Einstein Analytics
pat@streamsets.com, @metadaddy
Pat Patterson, Community Champion at StreamSets
2. Forward-Looking Statements
Statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if
any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-
looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of
product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of
management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments
and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our
service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of
growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and
any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain,
and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling
non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the
financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form
10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the
Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may
not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently
available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
4. Agenda
Einstein Analytics Basics
• Datasets, dataflows, lenses, dashboards
Integrating with Einstein Analytics via API
• External Data API, SAQL Queries
Creating Analytics Applications
• Templates, Packaging
6. Simple App: Transaction Analysis
We’re going to be working with:
• Transaction Data
• Timestamps, Amounts, Payment Type
etc
• Periodic Uploads via API
• Dashboard showing KPIs
8. Dataset
A set of source data
• Formatted and optimized for interactive
exploration
• Denormalized, highly compressed
• Comprises Date, Dimension & Measure fields
Create from
• Salesforce data
• External Sources
• CSV Upload
• API
• Dataflow
The foundation for lenses, dashboards, apps
9. Dataflow
A set of JSON instructions that runs to extract data and
create datasets
Composed of transformation nodes
• sfdcDigest, edgemart
• append, augment, computeExpression,
computeRelative, delta, dim2mea, filter, flatten,
sliceDataset, update
• sfdcRegister
Create via JSON definition file or Dataflow Editor
Start/stop/monitor/schedule via UI
Internal API to list/get/put/start
11. Dashboard
Continuously monitor key metrics of your business, analyzing
the results by key dimensions
Comprises charts, tables
Can include filters to allow data exploration
13. SAQL
Salesforce Analytics Query Language
Used to access data in Analytics Datasets
Used internally in lenses and dashboards to gather data for visualizations
Submit SAQL queries via the Analytics REST API, Dashboard/Lens JSON definition
q = load "streamsets_wave__Taxi";
q = filter q by 'payment_type' == "CRD";
q = group q by 'credit_card_type';
q = foreach q generate 'credit_card_type' as 'credit_card_type', count() as 'count';
q = order q by 'count' desc;
q = limit q 2000;
14. Analytics REST API
Execute queries, manipulate Analytics resources and metadata
Run Query:
• POST /services/data/v40.0/wave/query
{
"query” : "q = load "0Fb36000000LJM6CAO/0Fc36000002rEJhCAM"; q =
foreach q generate total_amount as total_amount; q = order q by
total_amount desc; q = limit q 10;”
}
Manipulate Dataset:
• GET/DELETE/PATCH
https://na1.salesforce.com/services/data/v40.0/wave/datasets/{ID}
15. Analytics External Data API
Asynchronous API, leveraging SObjects
• Create InsightsExternalData, InsightsExternalDataPart via REST or SOAP
• Data in InsightsExternalDataPart.DataFile as Base64-encoded CSV
• Set InsightsExternalData.Action to Process to start job
• Poll InsightsExternalData.Status to monitor job completion
Payload is CSV
medallion hack_license vendor_id payment_type fare_amount surcharge
F6F7D02179BE915B23EF2DB57836442D 088879B44B80CC9ED43724776C539370 VTS CRD 12 0.5
BE386D8524FCD16B3727DCF0A32D9B25 4EB96EC9F3A42794DEE233EC8A2616CE VTS CRD 12 0.5
E9FF471F36A91031FE5B6D6228674089 72E0B04464AD6513F6A613AABB04E701 VTS CRD 5.5 0.5
89D227B655E5C82AECF13C3F540D4CF4 BA96DE419E711691B9445D6A6307C170 CMT CSH 6.5 0
0BD7C8F5BA12B88E0B67BED28BEA73D8 9FD8F69F0804BDB5549F40E9DA1BE472 CMT CSH 6 0.5
0BD7C8F5BA12B88E0B67BED28BEA73D8 9FD8F69F0804BDB5549F40E9DA1BE472 CMT CSH 5.5 1
DFD2202EE08F7A8DC9A57B02ACB81FE2 51EE87E3205C985EF8431D850C786310 CMT CSH 5 0.5
16. Bonus: Insights Internal API
Officially undocumented, but used in open source Analytics Cloud DatasetUtils
List dataflows, get/put dataflow JSON, run dataflow programmatically!
RESTful interface, JSON payload
Use at your own risk!
Get/Update Dataflow JSON:
• GET/PATCH https://na1.salesforce.com/insights/internal_api/v1.0/esObject/workflow/{ID}/json
Run Dataflow:
• PUT https://na1.salesforce.com/insights/internal_api/v1.0/esObject/workflow/{ID}/start
18. Creating Analytics Applications
Analytics App is a container for other assets:
Lenses, Dashboards, Datasets etc
Prebuilt apps from Salesforce
• Sales Analytics
• Service Analytics
Create your own
• One-off
• Master app for a template
19. Analytics Template
Master app defines the template
Template contains dashboards, lenses, datasets, and,
optionally, dataflows
• At least one dashboard, and at least one dataset
• Your integration can access these resources via APIs – for
example add more datasets and run dataflows
Analytics Template assets control templatization of master
app
• template-info.json, variables.json, ui.json &
folder.json
20. Analytics Template Gotchas
You must use Workbench and either the
Force.com IDE or Force.com Migration Tool
• JSON template assets are accessed via the
Metadata API
• Skip Sauls has written a utility that helps!
You cannot include external datasets in your
template
• You will get a cryptic ‘EdgemartData null not found’
error message when you try to create an app
• If necessary, create a dummy dataset from CSV
21. Packaging Your Application
Similar to packaging any other app
• Setup | Create | Packages
Select the Wave Template only
• It’s tempting to select the master app, dataflow,
datasets etc, but doing so will cause errors when you
try to install the package!
Test, test and test!
23. Conclusion
Einstein Analytics is a platform for third-party innovation
There are some rough edges, but it is evolving quickly
Read the Analytics Template documentation carefully – here be dragons!
24. Resources
Einstein Analytics Developer Center
• https://developer.salesforce.com/devcenter/analytics
Analytics REST API Developer Guide
• https://developer.salesforce.com/docs/atlas.en-
us.bi_dev_guide_rest.meta/bi_dev_guide_rest/bi_resources_query.htm
Analytics SAQL Reference
• https://developer.salesforce.com/docs/atlas.en-
us.bi_dev_guide_saql.meta/bi_dev_guide_saql/bi_saql_intro.htm
External Data API Developer Guide
• https://developer.salesforce.com/docs/atlas.en-
us.bi_dev_guide_ext_data.meta/bi_dev_guide_ext_data/bi_ext_data_overview.htm
EADX_Samples Package
• https://login.salesforce.com/packaging/installPackage.apexp?p0=04tB00000009YKT
Notas do Editor
Audience – large shops, ISVs
Clarify use of REST API – data extraction, dataset manipulation