Metadata Discovery
Exposing Entities and Navigation Properties
The driver models SAP HANA XSA OData Service as relational tables and views.
The OData Service has relationships to other objects in the tables, which are expressed through foreign keys.
The driver dynamically obtains the metadata from the OData service exposed by the Multi Target SAP Hana XS Advanced application.
Take for example the following OData Service:
service { "tinyworld.tinydb::tinyf.world" as "Continents" navigates ("Continet_Countries" as "Country"); "tinyworld.tinydb::tinyf.Country" as "Countries"; "tinyworld.tinydb::tinyf.pollution_data" as "pollution_data"; association "Continet_Countries" principal "Continents"("continent") multiplicity "1" dependent "Countries"("partof.continent") multiplicity "*"; }
The driver will expose 3 tables and 1 view as specified in the .xsodata file. The exposed tables would be: Continents, Countries and pollution_data, and the exposed view would be: Continents_Country. Every configuration done to the .xsodata file will affect the OData Service and the data exposed by the driver.
Exposing Parameterized Calculation Views
Apart from the standard OData entities our driver exposes and supports querying for Parameterized Calculation Views configured as separate entity sets and also as navigation properties of another entity set.
The input parameters are exposed as standard table columns and its value can be provided as a WHERE clause condition. The input parameter column can be easily
identified as the driver appends the 'Parameters_' prefix to the column name. You should note the only server side supported operator for input parameters is EQUAL (=).
SELECT * FROM Orders WHERE Parameters_InputRegion='US'
The input parameters are required in the WHERE clause only if a default value is not set at design time on XSA Web IDE. This means that the example query
below should be executed correctly without providing any value for the input parameters if a default value is configured for the InputRegion parameter.
SELECT * FROM Orders
Let's consider the following example OData Service:
service { "tinyworld.tinydb::LocalOrders" as "Orders" keys("No") parameters via entity; "tinyworld.tinydb::ThresholdOrders" as "LocalThresholdOrders" keys("No") parameters via entity "ThresholdParams" results property "Execute"; "tinyworld.tinydb::tinyf.Customer" as "Customers" navigates ("customer_res" as "CustomerReservations"); "tinyworld.tinydb::ReservationView" as "Reservations" key ("resno") parameters via key and entity; association via parameters "customer_res" principal "Customer"("CustomerId") multiplicity "1" dependent "Reservations"("InputCustomerId") multiplicity "*"; }
The first exposed parameterized view is the 'Orders' view. Since it uses the default configuration, you can query it directly without any additional configuration.
As per the second one, 'LocalThresholdOrders', it uses a custom renamed parameters entity set 'ThresholdParams'. In order for the driver to correctly identify it as a parameterized view, you will need to provide the parameters entity name via the ParametersEntitySets connection property. If you have more than one renamed parameters entity set, then you can provide the comma separated list of the renamed parameter entity sets for each exposed parameterized view.
The driver also exposes and provides the possibility to query parameterized views configured as Navigation Properties of another entity. This type of navigation view does not support expanding, so in order to query it you will need to specify the base entity's key. You should not provide any value for the input parameters. They are neither required nor server side supported as their values are bound to the corresponding base entity fields.
In this example, the 'Reservations' calculation view is configured as the 'CustomerReservations' navigation property of the Customers' entity.
The example query below returns the 'CustomerReservations' for the customer with key value 1001.
SELECT * FROM Customers_ CustomerReservations WHERE CustomerId = '1001'