Skip to content

News

Search worldwide news articles from SQL via GDELT (free) or NewsAPI (with a key)

Connector software
Free and open source
Service credentials
Optional
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/news/index.md to help me query News 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.

Find recent headlines about a topic

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT title, url, domain, seendate
FROM news.main.news_search('climate summit', count := 10)
Result · first 5 rows
title url domain seendate
Джон Миршаймер , Джеффри Сакс и Чжэн Юннянь о встрече Си , Трампа и Путина ( So… https://inosmi.ru/20261201/mirshaymer-281480863.html inosmi.ru 2026-12-01 04:30
COP31 and the end of the global sustainability consensus https://www.freemalaysiatoday.com/category/opinion/2026/12/01/cop31-and-the-end… freemalaysiatoday.com 2026-12-01 04:30
粤车闯世界 : 从产品出海到跨国建链 https://news.southcn.com/node_457bd632a7/157a407388.shtml news.southcn.com 2026-12-01 04:30
Beyond a billion trees : ASEAN post - Manila reckoning - Academia http://www.thejakartapost.com/opinion/2026/12/01/beyond-a-billion-trees-aseans-… thejakartapost.com 2026-12-01 04:30
Trump administration issues new warning to US companies about risks in China https://www.koaa.com/politics/foreign-policy/trump-administration-issues-new-wa… koaa.com 2026-12-01 03:30

Quick start

Choose where to run News, 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.

setup.sql
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;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'news' AS news (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-news-worker'
);

3. Add service credentials (optional)

The default GDELT provider needs no key; a NewsAPI key adds that provider. Replace the placeholders with your service settings.

newsapi credentials

Optional NewsAPI.org key, needed only for news_search(..., provider := 'newsapi'); the default GDELT provider is keyless.

Get these credentials →
secret.sql
CREATE SECRET newsapi (
    TYPE newsapi,
    api_key '<NEWSAPI_API_KEY>'  -- secret
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT title, url, domain, seendate
FROM news.main.news_search('climate summit', count := 10)
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
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 with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'news' AS news (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-news-worker'
);

Overview

Global news search (GDELT by default; NewsAPI with a key) for SQL.

Catalog

Everything news exposes once attached — read straight from the worker's released build.

news 1 schema
main 1 table · 1 function

Global news search (GDELT by default; NewsAPI with a key) for SQL

Schema examples (4)
Examples (4)

List the available providers and their key requirements.

SELECT provider, requires_key
FROM news.main.news_providers
ORDER BY provider;

Fetch the 10 most recent headlines mentioning 'climate summit'.

SELECT title, url, domain, seendate
FROM news.main.news_search('climate summit', count := 10);
Result · first 5 rows
title url domain seendate
Джон Миршаймер , Джеффри Сакс и Чжэн Юннянь о встрече Си , Трампа и Путина ( So… https://inosmi.ru/20261201/mirshaymer-281480863.html inosmi.ru 2026-12-01 04:30
COP31 and the end of the global sustainability consensus https://www.freemalaysiatoday.com/category/opinion/2026/12/01/cop31-and-the-end… freemalaysiatoday.com 2026-12-01 04:30
粤车闯世界 : 从产品出海到跨国建链 https://news.southcn.com/node_457bd632a7/157a407388.shtml news.southcn.com 2026-12-01 04:30
Beyond a billion trees : ASEAN post - Manila reckoning - Academia http://www.thejakartapost.com/opinion/2026/12/01/beyond-a-billion-trees-aseans-… thejakartapost.com 2026-12-01 04:30
Trump administration issues new warning to US companies about risks in China https://www.koaa.com/politics/foreign-policy/trump-administration-issues-new-wa… koaa.com 2026-12-01 03:30

Rank domains by how many 'elections' articles they ran in the last two days.

SELECT domain, count(*) AS articles
FROM news.main.news_search('elections', timespan := '2d', count := 50)
GROUP BY domain
ORDER BY articles DESC;

Find the outlets covering both 'climate' and 'election': join the 100 most recent past-day articles of two news_search calls on domain and rank domains by combined article count (page_size := 100 keeps each search to one GDELT request).

WITH climate AS (SELECT domain, count(*) AS climate_articles FROM news.main.news_search('climate', count := 100, page_size := 100, timespan := '1d') GROUP BY domain), election AS (SELECT domain, count(*) AS election_articles FROM news.main.news_search('election', count := 100, page_size := 100, timespan := '1d') GROUP BY domain) SELECT domain, climate_articles, election_articles
FROM climate
JOIN election USING (domain)
ORDER BY climate_articles + election_articles DESC, domain
LIMIT 10;
Tables
news_providers 5 examples2 cols

Available news providers and whether each requires an API key.

Columns
provider VARCHAR
Provider name to pass as provider := '...'.
requires_keynot null BOOLEAN
Whether the provider needs an API key (via the secret provider).
ConstraintsPRIMARY KEY (provider)
Examples (5)

List the available providers and their key requirements.

SELECT provider, requires_key
FROM news.main.news_providers
ORDER BY provider;

Count how many providers are available.

SELECT count(*) AS provider_count FROM news.main.news_providers;

List only the free providers (no API key required).

SELECT provider FROM news.main.news_providers WHERE requires_key = false;
2 more examples
SELECT provider, requires_key
FROM news.main.news_providers()
ORDER BY provider;
SELECT provider FROM news.main.news_providers() WHERE requires_key = false;
Link
Table functions

Credentials

The secret type news declares, as reported by the worker itself.

newsapi

How to get these credentials

Optional NewsAPI.org key, needed only for news_search(..., provider := 'newsapi'); the default GDELT provider is keyless.

secret.sql
CREATE SECRET newsapi (
    TYPE newsapi,
    api_key '<NEWSAPI_API_KEY>'  -- secret
);
Key Type Required Description
api_key secret VARCHAR — NewsAPI.org API key, shown on your account page after registering at newsapi.org.

The worker doesn't mark which keys are required.

Create the secret in the same session, after attaching news — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

List the available providers and their key requirements.

SELECT provider, requires_key
FROM news.main.news_providers
ORDER BY provider

Uses news_providers

Rank domains by how many 'elections' articles they ran in the last two days.

SELECT domain, count(*) AS articles
FROM news.main.news_search('elections', timespan := '2d', count := 50)
GROUP BY domain
ORDER BY articles DESC

Uses news_search

Find the outlets covering both 'climate' and 'election': join the 100 most recent past-day articles of two news_search calls on domain and rank domains by combined article count (page_size := 100 keeps each search to one GDELT request).

WITH climate AS (SELECT domain, count(*) AS climate_articles FROM news.main.news_search('climate', count := 100, page_size := 100, timespan := '1d') GROUP BY domain), election AS (SELECT domain, count(*) AS election_articles FROM news.main.news_search('election', count := 100, page_size := 100, timespan := '1d') GROUP BY domain) SELECT domain, climate_articles, election_articles
FROM climate
JOIN election USING (domain)
ORDER BY climate_articles + election_articles DESC, domain
LIMIT 10

Uses news_search

Count how many providers are available.

SELECT count(*) AS provider_count FROM news.main.news_providers

Uses news_providers

List each provider and whether it requires an API key.

SELECT provider, requires_key
FROM news.main.news_providers()
ORDER BY provider

List only the free providers that need no API key.

SELECT provider FROM news.main.news_providers() WHERE requires_key = false

3 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.

  • List every news provider this worker supports and whether each one requires an API key.
  • How many news providers can I search?
  • Which news providers can I use for free, without supplying an API key?
  • Search recent worldwide news coverage of 'climate' with the default provider and confirm at least one article comes back.

News 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.