- Microsoft Tabular Modeling Cookbook
- Paul te Braak
- 795字
- 2021-11-12 16:24:14
Using data feeds
Data feeds allow a tabular model to consume XML data through an HTTP service—these are called the OData and .atomsvc feeds. The feed(s) can be defined to the model through either an OData service (which also can provide data) or a data service document (the .atomsvc
file) that specifies the URL to the service.
The Open Data Protocol (OData) is a standard protocol for creating and consuming data over existing technologies such as HTTP. This means that data can be imported into the model as a web service. The ability to use data which is not generated from the corporate environment extends the possible data sources that can be used for analysis. Data may be available for free or purchased from vendors (see http://datamarket.azure.com/ for both).
Getting ready
This recipe imports some data from an online database called Northwind
. Northwind
is a well-known sample database (actually, the data is not that important to us—only the technique used to import it is). We also examine importing data from a reporting services report (which is imported as an .atomsvc
file).
How to do it…
We firstly examine how to import data using OData and then we examine how to obtain data from a reporting services report.
- Open a new Workbook and launch the PowerPivot window.
- Click on the From Data Feeds button from the Get External Data group.
- Name the connection
NorthWind
, and use the following data feed URL: - Click on Test to test the connection, and then click on the Next button.
- The Table Import Wizard window will open, here we can select which tables we would like to import.
- Note that the Select Related Tables button is inactive and cannot be used.
- Highlight the
Products
table and select the Preview & Filter button. - The Wizard changes to a grid view; however, the table cannot be filtered (there are no filter dropdowns).
- Click on Finish to import the
Products
table. - Open a reporting services report and select the Export to Data Feed button. This button is identified in the following screenshot:
Tip
Unfortunately, we cannot provide specifics about the reporting services report that is required for this recipe. The configuration of reporting services and the associated creation of the report is outside the scope of this book. We do discuss the steps involved which are common to all reporting services reports.
These steps can also be applied to SharePoint lists (which have the same export button).
- A warning message will prompt to save or open a file with the name of your report and an
.atomsvc
extension. - Click on Save.
- Open PowerPivot and import data by clicking on the From Data Feeds button.
- Click on the Browse button and navigate to the file which was saved in the previous step. In this case, there is no need to provide the data feed URL.
- Select the file and click on the Open button.
- This time, the Table Import Wizard window lists report objects (Tablix's, lists and charts) as tables that can be imported to PowerPivot.
- Just like OData feed, there is no ability to filter the data or detect relationships between tables.
How it works…
The OData feed provides a web service which is essentially exposed to the tabular model as an XML feed, and may contain information about the data source, including tables within the source. This file can then be imported to the tabular model.
There's more...
As a web service, the OData feed can provide additional information to the service (such as a requested table, or a record within the table). For example, to specify a connection which only imports the customer's table, we could use the following data feed URL:
http://services.odata.org/Northwind/Northwind.svc/Customers
Additionally, we may provide the ability to filter and return a specific record. For example, to return a customer record by customer ID, we could use the following data feed URL:
When data is imported through an .atomsvc
file, all data objects within the report are exposed as tables to the Wizard (data objects in the report are controls that present data, that is, Tablix's, lists and charts). The name shown in the Table Import Wizard is the name of the object within the SSRS report.
When exported, the .atomsvc
file contains a list of objects that existed in the report at the time the file was exported. If the report is changed, and another object is added to the report, the .atomsvc
file will not be aware that the new dataset has been included, and re-using the file would only show the dataset that existed at the time of export.
Purchased data from the Azure marketplace may require authentication. In this case, the Azure DataMarket Dataset driver should be used.
- 極簡(jiǎn)算法史:從數(shù)學(xué)到機(jī)器的故事
- Interactive Data Visualization with Python
- Kali Linux Wireless Penetration Testing Beginner's Guide(Third Edition)
- 快人一步:系統(tǒng)性能提高之道
- Mastering Elasticsearch(Second Edition)
- Swift語(yǔ)言實(shí)戰(zhàn)晉級(jí)
- OpenMP核心技術(shù)指南
- RocketMQ實(shí)戰(zhàn)與原理解析
- Java7程序設(shè)計(jì)入門(mén)經(jīng)典
- Learning Bootstrap 4(Second Edition)
- 數(shù)據(jù)科學(xué)中的實(shí)用統(tǒng)計(jì)學(xué)(第2版)
- Ubuntu Server Cookbook
- Unity 3D UI Essentials
- C++ Primer(中文版)(第5版)
- Django 3 Web應(yīng)用開(kāi)發(fā)從零開(kāi)始學(xué)(視頻教學(xué)版)