OData
Read OData v2/v4 REST services from SQL, with $filter pushdown, automatic paging and metadata discovery
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available Β· $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/odata/index.md to help me query OData with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Read the first 5 People entities and pull a field out of the raw JSON.
Example output Β· captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5')
ORDER BY seq;
| seq | first_name |
|---|---|
| 0 | Russell |
| 1 | Scott |
| 2 | Ronald |
| 3 | Javier |
| 4 | Willie |
Quick start
Choose where to run OData, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the release directly
Downloads the latest release for your platform and caches it locally.
ATTACH 'odata' AS odata (
TYPE vgi,
LOCATION 'github-auto://Query-farm/vgi-odata'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'odata' AS odata (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-odata:0.5.0'
);
3. Run a query
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5')
ORDER BY seq;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connectorβs deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'odata' AS odata
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5')
ORDER BY seq;
Query Farm operates OData for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use odata as the catalog alias for the query below.
4. Run a query
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5')
ORDER BY seq;
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until youβre ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the release directly
Uses the verified release each time you attach the connector.
ATTACH 'odata' AS odata (
TYPE vgi,
LOCATION 'github-auto://Query-farm/[email protected]'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'odata' AS odata (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-odata:0.5.0'
);
Overview
Query OData v2/v4 services and return their entities as rows
Query any OData v2 or v4 REST service directly in SQL β discover its entity sets, read entities as rows, and inspect $metadata, all without writing a line of HTTP or JSON-parsing code.
OData (the Open Data Protocol) is the JSON-over-REST standard behind a huge slice of enterprise data: Microsoft Dynamics 365 and Dataverse, SAP Gateway (S/4HANA and NetWeaver), Microsoft Graph, and countless in-house APIs all speak it. This extension turns those services into queryable tables, so analysts and data engineers can join live OData entities against the rest of their warehouse using plain SQL. It is a generic OData reader, not a vendor-specific connector, so the same three functions work against TripPin, Northwind, Dynamics, SAP, or any spec-compliant service.
Under the hood the worker speaks OData over HTTP using only the Go standard library β no heavyweight SDK β and streams results to DuckDB over Apache Arrow. It transparently follows server-driven paging (the v4 @odata.nextLink and the v2 d.__next cursor), pushes $filter, $select, $orderby, and $top down to the service so the server does the work, and understands both response shapes: v4 (value / @odata.nextLink) and v2 (d.results / d.__next). Protected services are supported via an optional bearer token argument.
The main schema exposes a small set of read functions covering the whole workflow: discovering the entity sets a service advertises in its service document, reading an entity set as rows of raw JSON (with $filter/$select/$orderby/$top pushdown, automatic nextLink paging, and a configurable row cap), and parsing an entity type's properties and EDM types from its $metadata (EDMX) document β namespace-agnostically across both EDM 3.0 (v2) and EDM 4.0 (v4). It also ships a browsable registry of well-known auth-free public services so you can start querying without a URL in hand. The catalog's executable examples and per-object example queries provide ready-to-run SQL, and the usual path is discover β inspect β read.
Learn more
Catalog
Everything odata exposes once attached β read straight from the worker's
released build.
main 1 view Β· 3 functions
OData read functions: entity-set discovery, entity reads, and $metadata parsing.
Schema examples (6)
Discover every entity set the TripPin OData service exposes.
SELECT name
FROM odata.main.odata_entity_sets('https://services.odata.org/V4/TripPinService')
ORDER BY name;
Read the first 5 People entities and project a field out of the raw JSON.
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5');
Inspect the Person entity type's properties and EDM types from $metadata.
SELECT property, type
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService')
WHERE entity_type = 'Person';
Profile data completeness: for every property the Person entity type declares in $metadata, count how many TripPin People entities carry a non-empty value (not null, an empty string, or an empty collection), least-populated first.
SELECT m.property, m.type,
count(*) FILTER (WHERE coalesce(json_extract(p.entity, '$.' || m.property)::VARCHAR, 'null') NOT IN ('null', '""', '[]')) AS populated,
count(*) AS people
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService') AS m
CROSS JOIN odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People') AS p
WHERE m.entity_type = 'Person'
GROUP BY m.property, m.type
ORDER BY populated, m.property;
2 more examples
Summarise every numeric column of the Northwind Products entity set: take the Product properties $metadata declares as Edm.Int16/Int32/Decimal/Double and compute each one's min, max and average across all products.
WITH product_values AS (SELECT m.property, m.type, TRY_CAST(json_extract_string(p.entity, '$.' || m.property) AS DOUBLE) AS amount FROM odata.main.odata_metadata('https://services.odata.org/V4/Northwind/Northwind.svc') AS m CROSS JOIN odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Products') AS p WHERE m.entity_type = 'Product' AND m.type IN ('Edm.Int16', 'Edm.Int32', 'Edm.Decimal', 'Edm.Double')) SELECT property, type, min(amount) AS min_value, max(amount) AS max_value, round(avg(amount), 2) AS avg_value
FROM product_values
GROUP BY property, type
ORDER BY property;
Join two entity sets client-side: the five Northwind customers with the most orders, matching Orders to Customers on CustomerID and pushing $select down so only the needed fields are fetched.
SELECT json_extract_string(c.entity, '$.CompanyName') AS company,
json_extract_string(c.entity, '$.Country') AS country, count(*) AS orders
FROM odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Customers', "select" := 'CustomerID,CompanyName,Country') AS c
JOIN odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Orders', "select" := 'OrderID,CustomerID') AS o ON json_extract_string(o.entity, '$.CustomerID') = json_extract_string(c.entity, '$.CustomerID')
GROUP BY company, country
ORDER BY orders DESC, company
LIMIT 5;
odata_public_services
Curated registry of well-known public, auth-free OData services to try with the OData functions
List the auth-free public OData v4 services this worker ships, newest-style first.
SELECT name, service_url
FROM odata.main.odata_public_services
WHERE odata_version = 'v4'
ORDER BY name;
Count the registered public services grouped by OData protocol version.
SELECT odata_version, count(*) AS services
FROM odata.main.odata_public_services
GROUP BY odata_version
ORDER BY odata_version;
odata_entity_sets (service_url VARCHAR, token := VARCHAR)
List the entity sets exposed by an OData service (from its service document)
Discover every entity set the TripPin OData service exposes (People, Airlines, Airports, ...).
SELECT name
FROM odata.main.odata_entity_sets('https://services.odata.org/V4/TripPinService')
ORDER BY name;
odata_metadata (service_url VARCHAR, token := VARCHAR)
Parse an OData service's $metadata (EDMX XML); one row per entity-type property
Inspect the properties and EDM types of the Person entity type from the service's $metadata (EDMX) document.
SELECT property, type
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService')
WHERE entity_type = 'Person';
Profile data completeness: for every property the Person entity type declares in $metadata, count how many TripPin People entities carry a non-empty value (not null, an empty string, or an empty collection), least-populated first.
SELECT m.property, m.type,
count(*) FILTER (WHERE coalesce(json_extract(p.entity, '$.' || m.property)::VARCHAR, 'null') NOT IN ('null', '""', '[]')) AS populated,
count(*) AS people
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService') AS m
CROSS JOIN odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People') AS p
WHERE m.entity_type = 'Person'
GROUP BY m.property, m.type
ORDER BY populated, m.property;
odata_query (service_url VARCHAR, entity_set VARCHAR, filter := VARCHAR, select := VARCHAR, orderby := VARCHAR, top := VARCHAR, max_rows := BIGINT, token := VARCHAR, version := VARCHAR)
Read an OData entity set; one row per entity (raw JSON), following nextLink paging
Read the first 5 People entities from the public TripPin OData v4 service and pull a field out of the raw JSON.
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5');
Join two entity sets client-side: the five Northwind customers with the most orders, matching Orders to Customers on CustomerID and pushing $select down so only the needed fields are fetched.
SELECT json_extract_string(c.entity, '$.CompanyName') AS company,
json_extract_string(c.entity, '$.Country') AS country, count(*) AS orders
FROM odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Customers', "select" := 'CustomerID,CompanyName,Country') AS c
JOIN odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Orders', "select" := 'OrderID,CustomerID') AS o ON json_extract_string(o.entity, '$.CustomerID') = json_extract_string(c.entity, '$.CustomerID')
GROUP BY company, country
ORDER BY orders DESC, company
LIMIT 5;
Summarise every numeric column of the Northwind Products entity set: take the Product properties $metadata declares as Edm.Int16/Int32/Decimal/Double and compute each one's min, max and average across all products.
WITH product_values AS (SELECT m.property, m.type, TRY_CAST(json_extract_string(p.entity, '$.' || m.property) AS DOUBLE) AS amount FROM odata.main.odata_metadata('https://services.odata.org/V4/Northwind/Northwind.svc') AS m CROSS JOIN odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Products') AS p WHERE m.entity_type = 'Product' AND m.type IN ('Edm.Int16', 'Edm.Int32', 'Edm.Decimal', 'Edm.Double')) SELECT property, type, min(amount) AS min_value, max(amount) AS max_value, round(avg(amount), 2) AS avg_value
FROM product_values
GROUP BY property, type
ORDER BY property;
1 more example
Count the German customers in the public Northwind OData v4 sample, pushing the predicate down to the service via the OData $filter option.
SELECT count(*)
FROM odata.main.odata_query('https://services.odata.org/V4/Northwind/Northwind.svc', 'Customers', "filter" := 'Country eq ''Germany''', max_rows := 1000);
Try these queries
Discover the entity sets the TripPin OData service exposes.
SELECT name
FROM odata.main.odata_entity_sets('https://services.odata.org/V4/TripPinService')
ORDER BY name;
Uses odata_entity_sets
Inspect the properties and EDM types of the Person entity type from $metadata.
SELECT property, type
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService')
WHERE entity_type = 'Person'
ORDER BY property;
Uses odata_metadata
Read the first 5 People entities and project a field out of the raw JSON.
SELECT seq, json_extract_string(entity, '$.FirstName') AS first_name
FROM odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People', top := '5')
Uses odata_query
Inspect the Person entity type's properties and EDM types from $metadata.
SELECT property, type
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService')
WHERE entity_type = 'Person'
Uses odata_metadata
Profile data completeness: for every property the Person entity type declares in $metadata, count how many TripPin People entities carry a non-empty value (not null, an empty string, or an empty collection), least-populated first.
SELECT m.property, m.type,
count(*) FILTER (WHERE coalesce(json_extract(p.entity, '$.' || m.property)::VARCHAR, 'null') NOT IN ('null', '""', '[]')) AS populated,
count(*) AS people
FROM odata.main.odata_metadata('https://services.odata.org/V4/TripPinService') AS m
CROSS JOIN odata.main.odata_query('https://services.odata.org/V4/TripPinService', 'People') AS p
WHERE m.entity_type = 'Person'
GROUP BY m.property, m.type
ORDER BY populated, m.property
List the auth-free public OData v4 services this worker ships, newest-style first.
SELECT name, service_url
FROM odata.main.odata_public_services
WHERE odata_version = 'v4'
ORDER BY name
4 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Using the OData service at https://services.odata.org/V4/TripPinService, list the names of every entity set it exposes.
- How many People entities does the TripPin OData service at https://services.odata.org/V4/TripPinService contain in total (across all pages)?
- This OData extension ships a built-in registry of well-known public OData services. List the name and service_url of every OData v4 service in that registry.
OData is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
Elasticsearch
Databases & messaging
Query Elasticsearch and OpenSearch indices as SQL tables with consistent deep pagination
NATS
Databases & messaging
NATS server monitoring and read-only JetStream streams, consumers, messages, KV and object stores
Google Pub/Sub
Databases & messaging
Topics, subscriptions, schemas, IAM, backlog metrics and opt-in message replay from Google Cloud Pub/Sub