Skip to content

Ducks

Query duck species, sightings, seasonal range polygons and weekly regional abundance using Cornell Lab of Ornithology data

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

Inspect season dates in Cornell's public sample (requires network, not a key)

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT season, start_date, end_date, wraps_year
FROM ducks.main.seasonal_ranges('yebsap-example')
ORDER BY season

Quick start

Choose where to run Ducks, 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 the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'ducks' AS ducks (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-ducks'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

ebird credentials

Personal eBird API key, transmitted in the X-eBirdApiToken header.

Get these credentials →
secret.sql
CREATE SECRET ebird (
    TYPE ebird,
    token '<EBIRD_TOKEN>'  -- secret
);
ebirdst credentials

Separate eBird Status and Trends download access key.

Get these credentials →
secret.sql
CREATE SECRET ebirdst (
    TYPE ebirdst,
    token '<EBIRDST_TOKEN>'  -- secret
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT season, start_date, end_date, wraps_year
FROM ducks.main.seasonal_ranges('yebsap-example')
ORDER BY season
More example queries →
Technical details
Verified connector release
v0.2.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 the release directly

Uses the verified release each time you attach the connector.

ATTACH 'ducks' AS ducks (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Duck species reference data, recent eBird sightings and nearby birding hotspots, plus eBird Status and Trends seasonal ranges, weekly regional abundance and migration calendars, all from the Cornell Lab of Ornithology. Sightings and hotspots need an eBird API key.

Catalog

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

ducks 1 schema
main 1 table · 5 functions

Duck species reference table, eBird sightings and hotspots, and Status and Trends ranges and abundance.

Schema examples (7)
Examples (7)

Latest sighting per duck species near Boston (requires eBird key)

SELECT common_name, observed_at_local
FROM ducks.main.recent_sightings(42.36, -71.06)
ORDER BY common_name;

Latest Mallard sighting at each nearby location (requires eBird key)

SELECT location_name, reported_count, observed_at_local
FROM ducks.main.recent_sightings(42.36, -71.06, species_code := 'mallar3')
ORDER BY observed_at_local DESC, location_name;

Five nearest birding hotspots to Boston (requires eBird key)

SELECT location_name, distance_km
FROM ducks.main.nearby_hotspots(42.36, -71.06)
ORDER BY distance_km, location_name
LIMIT 5;

Inspect season dates in Cornell's public sample (requires network, not a key)

SELECT season, start_date, end_date, wraps_year
FROM ducks.main.seasonal_ranges('yebsap-example')
ORDER BY season;
3 more examples

Find seasonal ranges intersecting a point using DuckDB Spatial

SELECT season
FROM ducks.main.seasonal_ranges('yebsap-example')
WHERE ST_Intersects(ST_GeomFromWKB(geometry_wkb), ST_Point(-85,45))
ORDER BY season;

Weekly seasonal pattern for the public sample in a Michigan bounding region

SELECT week_date, mean_relative_abundance, coverage_fraction
FROM ducks.main.weekly_abundance('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date;

Locate positive peak weeks in the public sample, retaining coverage for interpretation

SELECT week_date, mean_relative_abundance, modeled_cell_count,
  coverage_fraction
FROM ducks.main.migration_calendar('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date;
Tables
species 1 example9 cols

Bundled eBird 2026 duck taxonomy: 140 species, including 9 flagged extinct taxa; no network or key required.

Columns
species_codenot null VARCHAR
Unique eBird 2026 species code, used in recent_sightings.
common_namenot null VARCHAR
English common name in the bundled taxonomy.
scientific_namenot null VARCHAR
Scientific binomial in the bundled taxonomy.
genusnot null VARCHAR
Scientific genus.
family_namenot null VARCHAR
Scientific family: Anatidae.
taxon_ordernot null DOUBLE
Unitless eBird taxonomic sort index; not a bird count.
extinctnot null BOOLEAN
Whether eBird marks the taxon extinct; false is not a conservation assessment.
taxonomy_versionnot null VARCHAR
Version of the bundled eBird taxonomy.
source_urlnot null VARCHAR
eBird species page URL.
ConstraintsPRIMARY KEY (species_code)
Example

Find the current Mallard code for a species-specific sighting query

SELECT species_code, scientific_name
FROM ducks.main.species
WHERE common_name = 'Mallard'
ORDER BY species_code;
Link
Table functions
migration_calendar (species_code VARCHAR, region_wkt VARCHAR, data_year := BIGINT, resolution := VARCHAR) 1 example

Find all positive peak weeks in a region's modeled annual abundance curve

Positional arguments
species_code VARCHAR
Species code in the selected model release, not necessarily the current taxonomy code. yebsap-example is a public non-duck sample.
region_wkt VARCHAR
Valid 2D WGS84 Polygon/MultiPolygon WKT, x=longitude, y=latitude. Use ST_AsText on a region geometry; holes are honored.
Named arguments
data_year := BIGINT
Explicit Status data version/prediction year; default 2023 (verified format). Not a current-year migration forecast. · default 2023
resolution := VARCHAR
Native product resolution: 27km (default), 9km or, for weekly grids, 3km. Downloads are bounded to 128 MiB. · default "27km"
Returns columns
species_code VARCHAR
Species identifier from the selected model release.
product_species_code VARCHAR
Requested product identifier; yebsap-example identifies the public sample.
prediction_year INTEGER
Model prediction year, not the current year.
week_date VARCHAR
Model week's date label in YYYY-MM-DD format; not an observed arrival date.
mean_relative_abundance DOUBLE
Mean expected birds per standardized 1-hour, 2-km checklist across modeled cells inside the region; NULL without modeled cells.
max_relative_abundance DOUBLE
Maximum expected birds per standardized checklist among modeled cells inside the region; NULL without modeled cells.
selected_cell_count INTEGER
Count of native grid cell centers strictly inside the polygon and raster extent, including unmodeled cells.
modeled_cell_count INTEGER
Count of selected cells with a finite prediction, including true zero abundance.
coverage_fraction DOUBLE
Modeled cell count / selected cell count (0–1); NULL when the region contains no raster cell centers.
resolution_km INTEGER
Native Equal Earth grid spacing in km; no interpolation or upsampling.
region_wkb BLOB
Requested region as WGS84 polygon WKB; use ST_GeomFromWKB to map or join it.
geometry_crs VARCHAR
Region coordinate reference system: EPSG:4326, x=longitude and y=latitude.
source_product VARCHAR
Upstream weekly raster object path, without credentials.
Example

Locate positive peak weeks in the public sample, retaining coverage for interpretation

SELECT week_date, mean_relative_abundance, modeled_cell_count,
  coverage_fraction
FROM ducks.main.migration_calendar('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date;
Link
nearby_hotspots (latitude DOUBLE, longitude DOUBLE, days_back := BIGINT, radius_km := DOUBLE) 1 example

Find nearby eBird birding locations for all birds, with distance and reporting history

Positional arguments
latitude DOUBLE
Search latitude in WGS84 decimal degrees (-90 to 90); sent rounded to two decimal places.
longitude DOUBLE
Search longitude in WGS84 decimal degrees (-180 to 180); sent rounded to two decimal places.
Named arguments
days_back := BIGINT
0 (default) omits recency filtering; 1 to 30 restricts to hotspots visited in that many days. · default 0
radius_km := DOUBLE
Search radius from the rounded center in km, 0 to 50; default 25. · default 25
Returns columns
location_id VARCHAR
eBird location identifier (join sightings to hotspots on this column).
location_name VARCHAR
eBird location display name; retain any access restrictions in the name.
latitude DOUBLE
Location latitude in WGS84 decimal degrees.
longitude DOUBLE
Location longitude in WGS84 decimal degrees.
distance_km DOUBLE
Great-circle distance in km from the API search center, rounded to 2 decimal degrees.
country_code VARCHAR
eBird country code.
subnational1_code VARCHAR
eBird state/province region code.
subnational2_code VARCHAR
eBird county/district code.
latest_observation_local VARCHAR
Latest reported local observation date/time for any bird, if supplied.
all_bird_species_count INTEGER
All-time number of bird species at this hotspot, including non-ducks; NULL when absent.
fetched_at TIMESTAMPTZ
Time the worker retrieved this snapshot, UTC.
Example

Five nearest birding hotspots to Boston (requires eBird key)

SELECT location_name, distance_km
FROM ducks.main.nearby_hotspots(42.36, -71.06)
ORDER BY distance_km, location_name
LIMIT 5;
Link
recent_sightings (latitude DOUBLE, longitude DOUBLE, days_back := BIGINT, hotspots_only := BOOLEAN, include_provisional := BOOLEAN, radius_km := DOUBLE, species_code := VARCHAR) 2 examples

Read the latest nearby sighting per duck species, or per location for a selected species

Positional arguments
latitude DOUBLE
Search latitude in WGS84 decimal degrees (-90 to 90); sent rounded to two decimal places.
longitude DOUBLE
Search longitude in WGS84 decimal degrees (-180 to 180); sent rounded to two decimal places.
Named arguments
days_back := BIGINT
Lookback in days, 1 to 30; default 14. · default 14
hotspots_only := BOOLEAN
Only return sightings at eBird hotspots; default false. · default false
include_provisional := BOOLEAN
Include provisional observations in the upstream search; default false. Inspect validity/review flags. · default false
radius_km := DOUBLE
Search radius from the rounded center in km, 0 to 50; default 25. · default 25
species_code := VARCHAR
Empty string returns latest per duck species; an extant code from species returns latest per location for that duck. · default ""
Returns columns
species_code VARCHAR
eBird code; joins to species.species_code.
common_name VARCHAR
English common name returned by eBird.
scientific_name VARCHAR
Scientific name returned by eBird.
location_id VARCHAR
eBird location identifier (join sightings to hotspots on this column).
location_name VARCHAR
eBird location display name; retain any access restrictions in the name.
latitude DOUBLE
Location latitude in WGS84 decimal degrees.
longitude DOUBLE
Location longitude in WGS84 decimal degrees.
distance_km DOUBLE
Great-circle distance in km from the API search center, rounded to 2 decimal degrees.
observed_at_local VARCHAR
Local observation date/time as supplied: YYYY-MM-DD or YYYY-MM-DD HH:MM. No timezone is implied.
reported_count INTEGER
Reported individuals; NULL means present but uncounted/missing. Never a population estimate.
observation_valid BOOLEAN
eBird obsValid flag, preserved independently of manual review.
observation_reviewed BOOLEAN
eBird obsReviewed flag; false does not necessarily mean invalid.
location_private BOOLEAN
eBird locationPrivate flag; a shared location is not permission to enter.
checklist_id VARCHAR
Source checklist identifier (subId), if supplied.
fetched_at TIMESTAMPTZ
Time the worker retrieved this snapshot, UTC.
Examples (2)

Latest sighting per duck species near Boston (requires eBird key)

SELECT common_name, observed_at_local
FROM ducks.main.recent_sightings(42.36, -71.06)
ORDER BY common_name;

Latest Mallard sighting at each nearby location (requires eBird key)

SELECT location_name, reported_count, observed_at_local
FROM ducks.main.recent_sightings(42.36, -71.06, species_code := 'mallar3')
ORDER BY observed_at_local DESC, location_name;
Link
seasonal_ranges (species_code VARCHAR, data_year := BIGINT, resolution := VARCHAR, season := VARCHAR) 2 examples

Read modeled seasonal range polygons as WGS84 WKB for DuckDB Spatial joins

Positional arguments
species_code VARCHAR
Species code in the selected model release, not necessarily the current taxonomy code. yebsap-example is a public non-duck sample.
Named arguments
data_year := BIGINT
Explicit Status data version/prediction year; default 2023 (verified format). Not a current-year migration forecast. · default 2023
resolution := VARCHAR
Native product resolution: 27km (default), 9km or, for weekly grids, 3km. Downloads are bounded to 128 MiB. · default "27km"
season := VARCHAR
Optional season filter; empty string returns all available seasons. · default ""
Returns columns
species_code VARCHAR
Species identifier recorded in the model product.
product_species_code VARCHAR
Requested product identifier; yebsap-example identifies the public sample.
common_name VARCHAR
English common name recorded in the model product.
scientific_name VARCHAR
Scientific name recorded in the model product.
prediction_year INTEGER
Model prediction year, not the retrieval year.
season VARCHAR
breeding, nonbreeding, prebreeding_migration, postbreeding_migration or resident.
start_date VARCHAR
Model-season start date in YYYY-MM-DD format.
end_date VARCHAR
Model-season end date; an earlier date than start_date wraps into the next annual cycle.
wraps_year BOOLEAN
True when the season crosses New Year; preserves upstream date labels.
resolution_km INTEGER
Native grid spacing in km used to derive the smoothed range.
geometry_wkb BLOB
Smoothed Polygon/MultiPolygon WKB in WGS84 longitude/latitude; use ST_GeomFromWKB.
geometry_crs VARCHAR
Geometry coordinate reference system, always EPSG:4326; coordinates are longitude/latitude.
source_product VARCHAR
Upstream object path, without credentials or signed download URL.
Examples (2)

Inspect season dates in Cornell's public sample (requires network, not a key)

SELECT season, start_date, end_date, wraps_year
FROM ducks.main.seasonal_ranges('yebsap-example')
ORDER BY season;

Find seasonal ranges intersecting a point using DuckDB Spatial

SELECT season
FROM ducks.main.seasonal_ranges('yebsap-example')
WHERE ST_Intersects(ST_GeomFromWKB(geometry_wkb), ST_Point(-85,45))
ORDER BY season;
Link
weekly_abundance (species_code VARCHAR, region_wkt VARCHAR, data_year := BIGINT, resolution := VARCHAR) 1 example

Summarize weekly modeled relative abundance inside a geographic polygon with coverage counts

Positional arguments
species_code VARCHAR
Species code in the selected model release, not necessarily the current taxonomy code. yebsap-example is a public non-duck sample.
region_wkt VARCHAR
Valid 2D WGS84 Polygon/MultiPolygon WKT, x=longitude, y=latitude. Use ST_AsText on a region geometry; holes are honored.
Named arguments
data_year := BIGINT
Explicit Status data version/prediction year; default 2023 (verified format). Not a current-year migration forecast. · default 2023
resolution := VARCHAR
Native product resolution: 27km (default), 9km or, for weekly grids, 3km. Downloads are bounded to 128 MiB. · default "27km"
Returns columns
species_code VARCHAR
Species identifier from the selected model release.
product_species_code VARCHAR
Requested product identifier; yebsap-example identifies the public sample.
prediction_year INTEGER
Model prediction year, not the current year.
week_date VARCHAR
Model week's date label in YYYY-MM-DD format; not an observed arrival date.
mean_relative_abundance DOUBLE
Mean expected birds per standardized 1-hour, 2-km checklist across modeled cells inside the region; NULL without modeled cells.
max_relative_abundance DOUBLE
Maximum expected birds per standardized checklist among modeled cells inside the region; NULL without modeled cells.
selected_cell_count INTEGER
Count of native grid cell centers strictly inside the polygon and raster extent, including unmodeled cells.
modeled_cell_count INTEGER
Count of selected cells with a finite prediction, including true zero abundance.
coverage_fraction DOUBLE
Modeled cell count / selected cell count (0–1); NULL when the region contains no raster cell centers.
resolution_km INTEGER
Native Equal Earth grid spacing in km; no interpolation or upsampling.
region_wkb BLOB
Requested region as WGS84 polygon WKB; use ST_GeomFromWKB to map or join it.
geometry_crs VARCHAR
Region coordinate reference system: EPSG:4326, x=longitude and y=latitude.
source_product VARCHAR
Upstream weekly raster object path, without credentials.
Example

Weekly seasonal pattern for the public sample in a Michigan bounding region

SELECT week_date, mean_relative_abundance, coverage_fraction
FROM ducks.main.weekly_abundance('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date;
Link

Credentials

The 2 secret types ducks declares, as reported by the worker itself.

ebird

How to get these credentials

Personal eBird API key, transmitted in the X-eBirdApiToken header.

secret.sql
CREATE SECRET ebird (
    TYPE ebird,
    token '<EBIRD_TOKEN>'  -- secret
);
Key Type Required Description
token secret VARCHAR — Your personal eBird API key.

The worker doesn't mark which keys are required.

ebirdst

How to get these credentials

Separate eBird Status and Trends download access key.

secret.sql
CREATE SECRET ebirdst (
    TYPE ebirdst,
    token '<EBIRDST_TOKEN>'  -- secret
);
Key Type Required Description
token secret VARCHAR — Status and Trends access key; not the recent-sightings API key.

The worker doesn't mark which keys are required.

Create the secret in the same session, after attaching ducks — 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

Latest sighting per duck species near Boston (requires eBird key)

SELECT common_name, observed_at_local
FROM ducks.main.recent_sightings(42.36, -71.06)
ORDER BY common_name

Uses recent_sightings

Five nearest birding hotspots to Boston (requires eBird key)

SELECT location_name, distance_km
FROM ducks.main.nearby_hotspots(42.36, -71.06)
ORDER BY distance_km, location_name
LIMIT 5

Uses nearby_hotspots

Find seasonal ranges intersecting a point using DuckDB Spatial

SELECT season
FROM ducks.main.seasonal_ranges('yebsap-example')
WHERE ST_Intersects(ST_GeomFromWKB(geometry_wkb), ST_Point(-85,45))
ORDER BY season

Uses seasonal_ranges

Weekly seasonal pattern for the public sample in a Michigan bounding region

SELECT week_date, mean_relative_abundance, coverage_fraction
FROM ducks.main.weekly_abundance('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date

Uses weekly_abundance

Locate positive peak weeks in the public sample, retaining coverage for interpretation

SELECT week_date, mean_relative_abundance, modeled_cell_count,
  coverage_fraction
FROM ducks.main.migration_calendar('yebsap-example', 'POLYGON((-90 41,-82 41,-82 49,-90 49,-90 41))')
ORDER BY week_date

Uses migration_calendar

Find the current Mallard code for a species-specific sighting query

SELECT species_code, scientific_name
FROM ducks.main.species
WHERE common_name = 'Mallard'
ORDER BY species_code

Uses species

1 more example 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.

  • Find the eBird species code and scientific name of Mallard in the ducks species table.
  • Using the public yebsap-example sample, list each seasonal range's season, start_date, end_date and wraps_year, ordered by season.

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