OData, or “SQL for the Web”—what is it? Do you need it? Here is a comprehensive guide to OData to help you answer these questions.
OData is a REST-based protocol for querying and updating data. It is built on technologies like HTTP, ATOM/XML and JSON. It is more flexible than other REST-based web services and provides a uniform way to describe the data and the data model for easy interoperability between data sources, applications, services and clients. Similar to ODBC and JDBC, OData gives you a single way of accessing various data sources.
As a producer, OData relieves you from spending your resources to defining and maintaining data access and discovery API. OData is an OASIS standard and is beginning the standardization process with ISO. It defines the best practice for building and consuming RESTful APIs.
Dissecting OData Technology
Feeds (collections of typed entries) are at the center of OData. Every entry is represented by a structured record with a key that holds a list of properties of both primitive and complex types. Entries can be part of a hierarchy and can also have related entries and related feeds through links. OData services also have the ability to expose Service Operations (simple, service-specific functions that accept input parameters and return entries or complex/primitive values).
In order to find the shape of an OData Service along with its structure, known links and service operations, OData services also expose a Service Metadata Document. These documents describe a given service’s Entity Data Model (the underlying abstract data model used by OData services to formalize the description of the resources it exposes).
Four Fundamentals of OData
In its most basic form, the OData model is fundamentally broken down into four different pieces:
- The OData Data Model—The OData Data Model is a server-side model, meaning that the data set is only available on the server and the client only knows the currently visible (requested) data. Operations, such as sorting and filtering, are done on the server. The client sends a request to the server and shows the returned data.
- Another key aspect of the model is an OData metadata document. They describe the Entity Data Model (EDM) for a given service, which is the underlying abstract data model used by OData services to formalize the description of the resources it exposes.
- The OData Protocol—This enables clients to make requests and retrieve responses from an OData service. This includes CRUD operations and OData defined query language. An OData service can be represented in XML-based format defined by Atom/AtomPub or in JSON.
- OData Client Libraries— OData libraries enable you to quickly and easily access and produce OData APIs. They exist for all kinds of interfaces including .NET, Java, C++, JavaScript, Python, Objective C, iOS and more.
- An OData Service—Simple OData services may consist of just a feed. More sophisticated services can have several feeds, and in that case it is useful to expose a service document that lists all the top-level feeds so clients can discover them and find out the addresses of each of them. For example, this URI, http://services.odata.org/OData/OData.svc, identifies the service document for a sample OData service.
To fully understand OData and practice these concepts on your own in C#, Olingo JavaScript client, C++ or Node.js, or if you want to contribute to OData as an Open Source project, we advise you try OData.org’s interactive tutorial, Understand OData in 6 Steps.
Our Personal OData Story
We have created lightweight OData (V2) Server for Databricks, which renders data stored in Databricks – tables and views as an OData Service. OData service is then consumed in SAP Fiori App as a Data Source.
This reduces the dependency on SAP HANA Database and also the complexity of creating CDS view; application logic which is traditionally embedded in CDS views in SAP; can now be embedded in Databricks SQL views.
Supports SAP Side-by-side Extensibility Model as shown in the diagram below