SlideShare a Scribd company logo
1 of 15
O, There’s My Data
The Open Data Protocol (OData)

Steve Hughes
Principal Consultant, Magenic
7/17/2012
Minnesota SQL Server User Group Meeting
I called you all here …

» Mark Souza
» Why use OData?
» Is it really necessary for Data Pros?
Introducing the Open Data Protocol
» Commonly known as OData
» Built on established protocols
  » REST
  » Atom
  » HTTP
» Open specification from Microsoft
» Designed to expose data from a variety of sources
OData Feeds
» Data structure support
  » Tables
  » Foreign keys
  » Stored procedures
» Data type support
  » Originally designed to support SQL 2008 and Entity Framework
  » Designed to be flexible
     » For example, Oracle EF implementation can be supported
Entity Data Model
» This is the structure of the feed
» Entity Type
  » Individual entity in the feed, similar to a row
» Entity Key
  » One or more entity properties making each entity type unique in the feed
» Entity Set
  » Collection of entities, essentially a table
» Service Operation
  » Function or stored procedures that can be used in the feed
Building a Model
Using Visual Studio to build a model
Windows Communication Foundation
» “WCF is a unified programming model for building service-oriented
  applications.” – MSDN (http://msdn.microsoft.com/en-
  us/library/dd936243.aspx)
» WCF supports multiple network protocols including HTTP and TCP
» WCF supports multiple message formats such as SOAP and REST


» We will use a WCF project to expose an OData feed based on our entity
  model
Building a WCF Service
Using Visual Studio to create the WCF Data Service
Native OData Support
» Consumers (read feeds)
  » PowerPivot & SSAS Tabular
  » Reporting Services
» Distributors (expose feeds)
  » Windows Azure Table Storage
  » Windows Azure Marketplace
  » SharePoint
  » Stack Overflow
PowerPivot Demo
Consuming our OData feed with PowerPivot for Excel
Painful OData Support a.k.a. SSIS
» SSIS does not natively support OData feeds
» My goal – use OData as an SSIS Source
» Technology tried along the way
  » LINQ
     » Able to connect to the feed but not the right tool for SSIS
  » ATOM & XML
     » Works – creates files on the server, not the best option, but it works
  » DataServiceQuery
     » Works – allows us to create SSIS Source task which returns rows
OData Feed in SSIS
Showing how to retrieve data from OData feeds in SSIS
References
» Connecting to Windows Azure SQL Database Through WCF:
    http://msdn.microsoft.com/en-us/library/windowsazure/ee621789.aspx
»   Loading Data from an ATOM Data Feed into SQL Server:
    http://channel9.msdn.com/Learn/Courses/SQL2008R2TrainingKit/SQL10R2UPD01/S
    QL10R2UPD01_HOL_03/Exercise-1-Loading-Data-from-an-ATOM-Data-Feed-into-
    SQL-Server
»   SSIS – Using a Script Component as a Source
    http://www.ssistalk.com/2007/04/04/ssis-using-a-script-component-as-a-source/
»   DataServiceContext Class: http://msdn.microsoft.com/en-
    us/library/system.data.services.client.dataservicecontext.aspx
»   Chris Woodruff – 31 Days of OData Blog Series:
    http://chriswoodruff.com/2011/11/19/announcing-the-31-days-of-odata-blog-
    series/
Wrap Up
» Creating an OData feed requires .NET coding
» Consuming an OData feed – Native vs Custom




»Q&A
Steve Hughes
»   Principal Consultant with Magenic
»   Over 15 years with SQL Server
»   Chair of Minnesota SQL Server User Group (PASSMN)
»   PASS Regional Mentor for US-NorthEast Region

» Contact Info
  » Blog: http://www.dataonwheels.com
  » Twitter: @DataOnWheels
  » Email: steveh@magenic.com

More Related Content

Viewers also liked

Aditya Hridayam
Aditya HridayamAditya Hridayam
Aditya Hridayamnesmaddy
 
Affirmative commands
Affirmative commandsAffirmative commands
Affirmative commandssrtasherman
 
XML Data Types in the Real World
XML Data Types in the Real WorldXML Data Types in the Real World
XML Data Types in the Real WorldSteve Hughes
 
A Window into Your Data: T-SQL Window Functions
A Window into Your Data: T-SQL Window FunctionsA Window into Your Data: T-SQL Window Functions
A Window into Your Data: T-SQL Window FunctionsSteve Hughes
 
Bharati College Logo Quiz Prelims
Bharati College Logo Quiz PrelimsBharati College Logo Quiz Prelims
Bharati College Logo Quiz PrelimsAbhishek Mishra
 

Viewers also liked (8)

Aditya Hridayam
Aditya HridayamAditya Hridayam
Aditya Hridayam
 
Affirmative commands
Affirmative commandsAffirmative commands
Affirmative commands
 
XML Data Types in the Real World
XML Data Types in the Real WorldXML Data Types in the Real World
XML Data Types in the Real World
 
A Window into Your Data: T-SQL Window Functions
A Window into Your Data: T-SQL Window FunctionsA Window into Your Data: T-SQL Window Functions
A Window into Your Data: T-SQL Window Functions
 
Bharati College Logo Quiz Prelims
Bharati College Logo Quiz PrelimsBharati College Logo Quiz Prelims
Bharati College Logo Quiz Prelims
 
Curriculum 05
Curriculum 05Curriculum 05
Curriculum 05
 
Plan de busqueda ppt
Plan de busqueda pptPlan de busqueda ppt
Plan de busqueda ppt
 
SerMimar Kütük Ev Villa Modelleri Katalog 2016
SerMimar Kütük Ev Villa Modelleri Katalog 2016SerMimar Kütük Ev Villa Modelleri Katalog 2016
SerMimar Kütük Ev Villa Modelleri Katalog 2016
 

O Theres My Data The Open Data Protocol (O Data)

  • 1. O, There’s My Data The Open Data Protocol (OData) Steve Hughes Principal Consultant, Magenic 7/17/2012 Minnesota SQL Server User Group Meeting
  • 2. I called you all here … » Mark Souza » Why use OData? » Is it really necessary for Data Pros?
  • 3. Introducing the Open Data Protocol » Commonly known as OData » Built on established protocols » REST » Atom » HTTP » Open specification from Microsoft » Designed to expose data from a variety of sources
  • 4. OData Feeds » Data structure support » Tables » Foreign keys » Stored procedures » Data type support » Originally designed to support SQL 2008 and Entity Framework » Designed to be flexible » For example, Oracle EF implementation can be supported
  • 5. Entity Data Model » This is the structure of the feed » Entity Type » Individual entity in the feed, similar to a row » Entity Key » One or more entity properties making each entity type unique in the feed » Entity Set » Collection of entities, essentially a table » Service Operation » Function or stored procedures that can be used in the feed
  • 6. Building a Model Using Visual Studio to build a model
  • 7. Windows Communication Foundation » “WCF is a unified programming model for building service-oriented applications.” – MSDN (http://msdn.microsoft.com/en- us/library/dd936243.aspx) » WCF supports multiple network protocols including HTTP and TCP » WCF supports multiple message formats such as SOAP and REST » We will use a WCF project to expose an OData feed based on our entity model
  • 8. Building a WCF Service Using Visual Studio to create the WCF Data Service
  • 9. Native OData Support » Consumers (read feeds) » PowerPivot & SSAS Tabular » Reporting Services » Distributors (expose feeds) » Windows Azure Table Storage » Windows Azure Marketplace » SharePoint » Stack Overflow
  • 10. PowerPivot Demo Consuming our OData feed with PowerPivot for Excel
  • 11. Painful OData Support a.k.a. SSIS » SSIS does not natively support OData feeds » My goal – use OData as an SSIS Source » Technology tried along the way » LINQ » Able to connect to the feed but not the right tool for SSIS » ATOM & XML » Works – creates files on the server, not the best option, but it works » DataServiceQuery » Works – allows us to create SSIS Source task which returns rows
  • 12. OData Feed in SSIS Showing how to retrieve data from OData feeds in SSIS
  • 13. References » Connecting to Windows Azure SQL Database Through WCF: http://msdn.microsoft.com/en-us/library/windowsazure/ee621789.aspx » Loading Data from an ATOM Data Feed into SQL Server: http://channel9.msdn.com/Learn/Courses/SQL2008R2TrainingKit/SQL10R2UPD01/S QL10R2UPD01_HOL_03/Exercise-1-Loading-Data-from-an-ATOM-Data-Feed-into- SQL-Server » SSIS – Using a Script Component as a Source http://www.ssistalk.com/2007/04/04/ssis-using-a-script-component-as-a-source/ » DataServiceContext Class: http://msdn.microsoft.com/en- us/library/system.data.services.client.dataservicecontext.aspx » Chris Woodruff – 31 Days of OData Blog Series: http://chriswoodruff.com/2011/11/19/announcing-the-31-days-of-odata-blog- series/
  • 14. Wrap Up » Creating an OData feed requires .NET coding » Consuming an OData feed – Native vs Custom »Q&A
  • 15. Steve Hughes » Principal Consultant with Magenic » Over 15 years with SQL Server » Chair of Minnesota SQL Server User Group (PASSMN) » PASS Regional Mentor for US-NorthEast Region » Contact Info » Blog: http://www.dataonwheels.com » Twitter: @DataOnWheels » Email: steveh@magenic.com

Editor's Notes

  1. New ProjectUse WCF Service Application TemplateNeed to Run As Admin to support IIS workRemove .cs file and App_Data, not needed for this solutionAdd New Item – Data – ADO.NET Entity Data ModelUse Wizard and Generate from DatabaseChoose data connection – AdventureWorks 2008 versionChoose your database objectsChoosing Department and EmployeeClick Finish to generate modelView model browser – note entity sets are pluralized entity types
  2. Add New Item – Web – WCF Data Service(remove other service)Open .svc.cs fileAdd DataService Name in class definitionAdd config.SetEntitySetAccessRule(“MyEntitySet”,EntitySetRights.AllRead); for each table to be exposed as an entity setDebug - .svc file to see Atom definition
  3. In PowerPivot windowChoose Connect to a Data FeedGive it a nameUse the URL from the feed - .svcChoose tables which are actually entity setsClick finishNOTE: for my demo to work I needed to change the connection string in the package to use an SQL user. Otherwise it will pass windows credentials, I am not on a domain so that is likely my issue.
  4. Walk through both packagesStart with UsingATOMCreate ATOM FileProcess ATOM FileLoad DataThen UsingRSSGet ODataSource Script Component walk through