Introducing OData: Data Access for the Web, Cloud, Devices, and More

[This article was contributed by the SQL Azure team.]

David Chappell recently completed a whitepaper on OData that I encourage you to take a look
at.  You can view it here, or download a PDF
version.  David does an outstanding job
providing an overview of OData, the problems it solves, practical usage
scenarios, and a look at the protocol itself. 
If you’re quitting work for the day, stop here and read David’s
whitepaper.  If you have a few more
minutes to spare, then continue reading. :)


Many of our partners have started using OData in their
commercial releases.  Two notable recent
ones are SAP, who are making it an integral part of their Netweaver offering to
extend SAP data to devices and social applications.  You can read more about it here.

EastBanc is also utilizing OData and SQL Azure to share
real-time data from Washington metro area transit systems to share up to date
schedules for trains and buses.  A case
study on that is here.

If you’re not already familiar with the Open Data Protocol (OData), it’s a Web protocol for querying and
updating data that provides a way to unlock your data and free it from silos
that exist in applications today.  OData
does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol
(AtomPub) and JSON to provide access to
information from a variety of applications, services, and stores. The protocol
emerged from experiences implementing AtomPub clients and servers in a variety
of products over the past several years. OData is being used to expose and
access information from a variety of sources including, but not limited to,
relational databases, file systems, content management systems and traditional
Web sites.

At this point you may be asking – why talk about OData on
the SQL Azure blog?  Because OData is an
open protocol and what I like to call “the
language of data on the web”
.   Let’s
take an example of a web service that does a lookup of an employee.  The tricky thing here is that this turns into
multiple service calls, or methods with multiple input parameters to get
results with different input and output criteria, like:

  • GetEmployeeByLastName
  • GetEmployeeByID
  • GetEmployeeStartingWith

…and so on, making a simple lookup pretty complicated with
multiple options based on different search criteria, and if multiple results
are returned – having to factor in paging or selecting the top 50 results if
there happen to be thousands.  OData
reduces this complexity by being able to accomplish
all these queries and also allow updates to data in one service method
.  If you visit the OData SDK page, there are
libraries for utilizing OData in PHP,
Java & Android, Ruby, Windows Phone 7, iOS, Silverlight, and .NET (of course!).  There’s
also a library to interact with OData via JavaScript and jQuery, called DataJS.

One Service Powering Multiple Experiences

In addition to powering mobile experiences, the openness of
the OData protocol can power multiple user experiences.  In the videos below we show how to utilize
OData to access SQL Azure cloud data on both Android and Windows Phone 7
devices.  OData is also natively
supported in PowerPivot, making complex BI
attainable today with SQL Azure cloud databases – again using the same OData
service that can power an Android, iOS, Windows Phone, and web experience. 

Things get even more interesting for BI when you consider Windows Azure DataMarket, our one-stop
shop for accessing public domain and commercial data-sets – all consistently
accessible via OData.  Joining that data
with your application’s data can create some interesting new insights.  Is there a relationship between retail sales
and weather?  Hmm…DataMarket has weather
data available from WeatherBug.

Get Microsoft Silverlight

View this video as a WMV


Sharing Data with Android and SQL Azure via


Get Microsoft Silverlight

View this video as a WMV


Sharing Data with Windows Phone and SQL
Azure via OData

Is it Hard?

No.  And more partners
are using it, like SAP and EastBanc I mentioned at the top.  As I mentioned earlier there are libraries
for most platforms.  Here are some links
to get started with SQL Azure:

  • SQL Azure
    has an OData service you can get started with today that will create
    an OData endpoint for your SQL Azure database.
  • For .NET developers, you can also create your
    own in about 5 lines of code utilizing WCF Data Services that
    you can deploy locally, or in a web role in Windows Azure.  These libraries are already included in the
    .NET Framework. 

Hope this has whetted your appetite just a bit to get
started.  For all of you in the U.S.,
have a great Memorial Day weekend!