此内容没有您所选择的语言版本。

8.3. How to Access the Data?


This section describes how to access the data. For example, assume you have a vdb by name northwind deployed and that vdb has a table customers in a model called NW. You can access the table as:
http://localhost:8080/odata/northwind.1/NW.customers
Copy to Clipboard Toggle word wrap
This is similar to making a JDBC/ODBC connection and issuing a SQL call as
SELECT * FROM NW.customers
Copy to Clipboard Toggle word wrap

Note

You need to fully qualify the table name along with the model name. Also, use correct case (upper or lower) as used in the VDB.
The returned results from OData query can be in Atom/AtomPub XML format or JSON format. By default AtomPub based XML result is returned.

Note

When you issue the above query if you receive a message similar to:
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>NotFoundException</code>
<message lang="en-US">EdmEntitySet NW.customer is not found</message>
</error>
Copy to Clipboard Toggle word wrap
Then, it means that either you supplied the model-name.table-name combination wrong, in that case, check spelling and case. Or your table did not have any PRIMARY KEY or UNIQUE KEY(s) on them. Since OData access is more key oriented, it is mandatory that every table Teiid exposes through OData interface must have a PK or at least one UNIQUE key.
Teiid does support composite PRIMARY KEY too.
If you are not able to see all the rows, then see the configuration section below for more details. Issue another call as:
http://localhost:8080/odata/northwind.1/NW.customers?$skiptoken=256
Copy to Clipboard Toggle word wrap
You can also submit criteria with along the query to filter the results:
http://localhost:8080/odata/northwind.1/NW.customers?$filter=name eq 'bob'
Copy to Clipboard Toggle word wrap
This is similar to making a JDBC/ODBC connection and issuing a SQL call as:
SELECT * FROM NW.customers where name = 'bob'
Copy to Clipboard Toggle word wrap
The power of OData querying comes from navigations from one entity to another, similar to the foreign key relationships in the relational databases. For example, if customers table had a association with orders table, where say customers table had primary key of ID then, you can issue a query:
http://localhost:8080/odata/northwind.1/NW.customers(1234)/NW.orders?$filter=orderdate > '12-31-2012'
Copy to Clipboard Toggle word wrap
This is similar to making a JDBC/ODBC connection and issuing a SQL call as:
SELECT * FROM NW.orders o join NW.customers c join o.customer_id = c.id where c.id=1234 and o.orderdate > '12-31-2012'
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat