NASCAR
Cup, O'Reilly Auto Parts and Truck Series schedules, results, standings and laps
- 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/nascar/index.md to help me query NASCAR 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.
Current Cup Series top ten.
Example output Β· captured
- Connector release
- v0.3.1
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10
| position | driver_name | points | points_behind_leader | wins | top_5 |
|---|---|---|---|---|---|
| 1 | Kyle Larson | 2501 | 0 | 3 | 15 |
| 2 | Christopher Bell | 2452 | 49 | 1 | 16 |
| 3 | Denny Hamlin | 2445 | 56 | 4 | 16 |
| 4 | Ryan Blaney | 2407 | 94 | 4 | 12 |
| 5 | Tyler Reddick | 2397 | 104 | 6 | 15 |
Quick start
Choose where to run NASCAR, 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 with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'nascar' AS nascar (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-nascar'
);
3. Run a query
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10
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 'nascar' AS nascar
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10
Query Farm operates NASCAR 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 nascar as the catalog alias for the query below.
4. Run a query
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10
Technical details
- Verified connector release
- v0.3.1
- 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 with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'nascar' AS nascar (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-nascar'
);
Overview
Read-only NASCAR schedules, results, standings, lap times and pit stops from NASCAR's feeds
Query NASCAR's three national series directly from SQL: schedules and race summaries since 2015, official results, stage and session results, cautions, lead changes, lap-by-lap times (2020 onwards), pit stops, commentary, loop-data driver ratings and current points standings.
Data model
Races are identified by race_id; drivers by driver_id. Find a race in current_schedule or schedule(), then pass its race_id (and season to skip the lookup) to the per-race functions. Missing upstream files yield empty results, not errors.
Data is fetched on demand and cached in-process; nothing is rehosted. Not affiliated with NASCAR.
Sources and references
- NASCAR.com: the official site whose public
cf.nascar.comJSON feeds this worker reads, for example the driver directory feed.
Catalog
Everything nascar exposes once attached β read straight from the worker's
released build.
main 4 tables Β· 16 functions
NASCAR national-series schedules, results, standings and race detail
Schema examples (6)
Current Cup Series top ten.
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10;
| position | driver_name | points | points_behind_leader | wins | top_5 |
|---|---|---|---|---|---|
| 1 | Kyle Larson | 2501 | 0 | 3 | 15 |
| 2 | Christopher Bell | 2452 | 49 | 1 | 16 |
| 3 | Denny Hamlin | 2445 | 56 | 4 | 16 |
| 4 | Ryan Blaney | 2407 | 94 | 4 | 12 |
| 5 | Tyler Reddick | 2397 | 104 | 6 | 15 |
Points leader of each series.
SELECT series_name, driver_name, points
FROM nascar.main.current_standings
WHERE position = 1
ORDER BY series_id;
Top five of each series' latest race with each driver's championship position, season points and wins from the current standings.
SELECT s.series_name, r.finishing_position, r.driver_name,
s.position AS championship_position, s.points, s.wins
FROM nascar.main.last_race_results r
JOIN nascar.main.current_standings s USING (series_id, driver_id)
WHERE r.finishing_position <= 5
ORDER BY r.series_id, r.finishing_position;
Top ten of the 2026 Cup Series Championship Race with the green- and yellow-flag pit stops each made and their total time on pit road.
SELECT r.finishing_position, r.driver_name, count(*) AS stops,
sum(p.pit_road_seconds) AS pit_road_seconds
FROM nascar.main.race_results(5601, season := 2026) r
JOIN nascar.main.pit_stops(5601, season := 2026) p USING (driver_id)
WHERE r.finishing_position <= 10 AND p.pit_in_flag_state IN (1, 2)
GROUP BY r.finishing_position, r.driver_name
ORDER BY r.finishing_position;
2 more examples
Where each stage winner of the 2026 Cup Series Championship Race finished, and the laps they led.
SELECT s.stage_number, s.driver_name, s.stage_points, r.finishing_position,
r.laps_led
FROM nascar.main.stage_results(5601, season := 2026) s
JOIN nascar.main.race_results(5601, season := 2026) r USING (driver_id)
WHERE s.position = 1
ORDER BY s.stage_number;
Drivers named most often in the 2026 Cup Series Championship Race lap-by-lap commentary, with where each finished.
WITH mentions AS (SELECT unnest(driver_ids) AS driver_id FROM nascar.main.lap_notes(5601, season := 2026)) SELECT r.driver_name, count(*) AS mentions, r.finishing_position
FROM mentions
JOIN nascar.main.race_results(5601, season := 2026) r USING (driver_id)
GROUP BY r.driver_name, r.finishing_position
ORDER BY mentions DESC, r.finishing_position
LIMIT 10;
current_schedule
Current-season race schedule and summaries for all three national series
Cup Series winners so far this season.
SELECT race_date, race_name, track_name, winner_name
FROM nascar.main.current_schedule
WHERE series_id = 1 AND is_completed
ORDER BY race_date;
current_standings
Current-season driver points standings, one row per driver per series
Current Cup Series top ten.
SELECT position, driver_name, points, points_behind_leader, wins, top_5
FROM nascar.main.current_standings
WHERE series_id = 1
ORDER BY position
LIMIT 10;
| position | driver_name | points | points_behind_leader | wins | top_5 |
|---|---|---|---|---|---|
| 1 | Kyle Larson | 2501 | 0 | 3 | 15 |
| 2 | Christopher Bell | 2452 | 49 | 1 | 16 |
| 3 | Denny Hamlin | 2445 | 56 | 4 | 16 |
| 4 | Ryan Blaney | 2407 | 94 | 4 | 12 |
| 5 | Tyler Reddick | 2397 | 104 | 6 | 15 |
Points leader of each series.
SELECT series_name, driver_name, points
FROM nascar.main.current_standings
WHERE position = 1
ORDER BY series_id;
last_race_results
Official results of each series' most recently completed race
Top five of the latest Cup Series race.
SELECT race_name, finishing_position, driver_name, team_name, laps_led
FROM nascar.main.last_race_results
WHERE series_id = 1 AND finishing_position <= 5
ORDER BY finishing_position;
Top five of each series' latest race with each driver's championship position, season points and wins from the current standings.
SELECT s.series_name, r.finishing_position, r.driver_name,
s.position AS championship_position, s.points, s.wins
FROM nascar.main.last_race_results r
JOIN nascar.main.current_standings s USING (series_id, driver_id)
WHERE r.finishing_position <= 5
ORDER BY r.series_id, r.finishing_position;
live_race
The NASCAR session currently on track; empty when nothing is running
Whether a session is on track, with its lap and flag; returns 0 with NULL session, lap and flag when no session is running.
SELECT count(*) AS sessions_on_track, max(run_name) AS session,
max(lap_number) AS lap, max(flag) AS flag
FROM nascar.main.live_race;
all_current_schedule ()
Current NASCAR season schedule (scan behind current_schedule)
Races scheduled and already run in each series this season.
SELECT series_name, count(*) AS races,
count(*) FILTER (WHERE is_completed) AS completed
FROM nascar.main.all_current_schedule()
GROUP BY series_name
ORDER BY series_name;
all_current_standings ()
Current NASCAR driver points standings (scan behind current_standings)
Read the table's backing scan directly: the Cup Series top ten.
SELECT position, driver_name, points, wins
FROM nascar.main.all_current_standings()
WHERE series_id = 1
ORDER BY position
LIMIT 10;
all_last_race_results ()
Results of each series' most recent race (scan behind last_race_results)
Read the table's backing scan directly: each series' latest winner.
SELECT series_id, race_name, driver_name
FROM nascar.main.all_last_race_results()
WHERE finishing_position = 1
ORDER BY series_id;
all_live_race ()
Status of the NASCAR session currently on track (scan behind live_race)
Read the table's backing scan directly: is anything on track right now? Returns 0 with NULL lap and flag when no session is running.
SELECT count(*) AS sessions_on_track, max(lap_number) AS lap,
max(flag) AS flag
FROM nascar.main.all_live_race();
drivers (series := VARCHAR)
NASCAR driver profiles: names, birth dates, hometowns, teams and rookie year
Published Cup Series driver profiles with hometowns.
SELECT full_name, team, hometown_city, hometown_state, birth_date
FROM nascar.main.drivers(series := 'cup')
WHERE profile_published
ORDER BY last_name;
lap_notes (race_id INTEGER, season := INTEGER)
NASCAR's lap-by-lap race commentary notes for one race
Commentary for the final ten laps of the 2026 Cup Series Championship Race.
SELECT lap, note
FROM nascar.main.lap_notes(5601, season := 2026)
WHERE lap >= 258
ORDER BY lap, note_id;
Drivers named most often in the 2026 Cup Series Championship Race lap-by-lap commentary, with where each finished.
WITH mentions AS (SELECT unnest(driver_ids) AS driver_id FROM nascar.main.lap_notes(5601, season := 2026)) SELECT r.driver_name, count(*) AS mentions, r.finishing_position
FROM mentions
JOIN nascar.main.race_results(5601, season := 2026) r USING (driver_id)
GROUP BY r.driver_name, r.finishing_position
ORDER BY mentions DESC, r.finishing_position
LIMIT 10;
lap_times (race_id INTEGER, season := INTEGER)
Lap-by-lap times, speeds and running positions for one NASCAR race (2020 onwards)
Each driver's fastest lap in the 2026 Cup Series Championship Race.
SELECT driver_name, min(lap_time_seconds) AS best_lap,
max(lap_speed) AS best_speed
FROM nascar.main.lap_times(5601, season := 2026)
GROUP BY driver_name
ORDER BY best_lap
LIMIT 10;
loop_stats (race_id INTEGER, season := INTEGER)
NASCAR loop-data statistics (driver rating, passes, average position) for one race
Highest driver ratings in the 2026 Cup Series Championship Race.
SELECT driver_name, driver_rating, green_flag_passes, quality_passes,
average_position
FROM nascar.main.loop_stats(5601, season := 2026)
ORDER BY driver_rating DESC
LIMIT 10;
pit_stops (race_id INTEGER, season := INTEGER)
Timed pit-road visits with tire service for one NASCAR race
Fastest four-tire green-flag stops in the 2026 Cup Series Championship Race.
SELECT driver_name, lap, stop_seconds, pit_road_seconds
FROM nascar.main.pit_stops(5601, season := 2026)
WHERE stop_type = 'FOUR_WHEEL_CHANGE' AND pit_in_flag_state = 1
ORDER BY stop_seconds
LIMIT 10;
Top ten of the 2026 Cup Series Championship Race with the green- and yellow-flag pit stops each made and their total time on pit road.
SELECT r.finishing_position, r.driver_name, count(*) AS stops,
sum(p.pit_road_seconds) AS pit_road_seconds
FROM nascar.main.race_results(5601, season := 2026) r
JOIN nascar.main.pit_stops(5601, season := 2026) p USING (driver_id)
WHERE r.finishing_position <= 10 AND p.pit_in_flag_state IN (1, 2)
GROUP BY r.finishing_position, r.driver_name
ORDER BY r.finishing_position;
race_cautions (race_id INTEGER, season := INTEGER)
Caution periods (yellow flags) of one NASCAR race
Cautions in the 2026 Cup Series Championship Race.
SELECT caution_number, start_lap, end_lap, laps, reason, comment
FROM nascar.main.race_cautions(5601, season := 2026)
ORDER BY caution_number;
race_leaders (race_id INTEGER, season := INTEGER)
Lap-by-lap lead stints of one NASCAR race
Laps led by driver in the 2026 Cup Series Championship Race.
SELECT driver_name, sum(laps_led) AS laps_led, count(*) AS stints
FROM nascar.main.race_leaders(5601, season := 2026)
GROUP BY driver_name
ORDER BY laps_led DESC;
race_results (race_id INTEGER, season := INTEGER)
Official finishing order of one NASCAR race
Finishing order of the 2026 Cup Series Championship Race.
SELECT finishing_position, car_number, driver_name, team_name, laps_led,
finishing_status
FROM nascar.main.race_results(5601, season := 2026)
ORDER BY finishing_position;
schedule (season := INTEGER, series := VARCHAR)
NASCAR race schedule and race summaries by season and series
The 2025 Cup Series points races and their winners.
SELECT race_date, race_name, track_name, winner_name
FROM nascar.main.schedule(season := 2025, series := 'cup')
WHERE is_points_race
ORDER BY race_date;
Tracks visited by every national series in 2024.
SELECT track_name, count(DISTINCT series_id) AS series
FROM nascar.main.schedule(season := 2024)
GROUP BY track_name
HAVING series = 3;
season_results (season := INTEGER, series := VARCHAR)
Official results of every completed race in one NASCAR series season
2025 Cup Series wins and top-fives by driver, points races only.
SELECT r.driver_name,
count(*) FILTER (WHERE r.finishing_position = 1) AS wins,
count(*) FILTER (WHERE r.finishing_position <= 5) AS top_5
FROM nascar.main.season_results(season := 2025) r
JOIN nascar.main.schedule(season := 2025, series := 'cup') USING (race_id)
WHERE is_points_race
GROUP BY r.driver_name
ORDER BY wins DESC, top_5 DESC
LIMIT 10;
Laps led by team in the 2025 Truck Series.
SELECT team_name, sum(laps_led) AS laps_led
FROM nascar.main.season_results(season := 2025, series := 'truck')
GROUP BY team_name
ORDER BY laps_led DESC;
session_results (race_id INTEGER, season := INTEGER)
Practice and qualifying results for one NASCAR race weekend
Qualifying order for the 2026 Cup Series Championship Race.
SELECT position, driver_name, best_lap_time_seconds, best_lap_speed
FROM nascar.main.session_results(5601, season := 2026)
WHERE run_type = 'qualifying'
ORDER BY position;
stage_results (race_id INTEGER, season := INTEGER)
Top-ten stage finishes and stage points for one NASCAR race
Stage winners of the 2026 Cup Series Championship Race.
SELECT stage_number, driver_name, stage_points
FROM nascar.main.stage_results(5601, season := 2026)
WHERE position = 1
ORDER BY stage_number;
Where each stage winner of the 2026 Cup Series Championship Race finished, and the laps they led.
SELECT s.stage_number, s.driver_name, s.stage_points, r.finishing_position,
r.laps_led
FROM nascar.main.stage_results(5601, season := 2026) s
JOIN nascar.main.race_results(5601, season := 2026) r USING (driver_id)
WHERE s.position = 1
ORDER BY s.stage_number;
Try these queries
current_schedule_is_populated β The current season's schedule covers all three national series.
SELECT count(DISTINCT series_id) = 3 AS populated
FROM nascar.main.current_schedule;
Uses current_schedule
current_standings_have_drivers β Every current standings row has a driver and a non-negative points total.
SELECT count(*) > 0 AND bool_and(points >= 0) AND count(driver_id) = count(*) AS valid
FROM nascar.main.current_standings;
Uses current_standings
championship_race_2026_winner β Ryan Blaney won the 2026 Cup Series Championship Race (race 5601).
SELECT driver_name
FROM nascar.main.race_results(5601, season := 2026)
WHERE finishing_position = 1;
Uses race_results
lead_stints_match_laps_led β Lead stints in race 5601 add up to the 267 laps run.
SELECT sum(laps_led)::INTEGER AS laps
FROM nascar.main.race_leaders(5601, season := 2026);
Uses race_leaders
Top five of each series' latest race with each driver's championship position, season points and wins from the current standings.
SELECT s.series_name, r.finishing_position, r.driver_name,
s.position AS championship_position, s.points, s.wins
FROM nascar.main.last_race_results r
JOIN nascar.main.current_standings s USING (series_id, driver_id)
WHERE r.finishing_position <= 5
ORDER BY r.series_id, r.finishing_position
Where each stage winner of the 2026 Cup Series Championship Race finished, and the laps they led.
SELECT s.stage_number, s.driver_name, s.stage_points, r.finishing_position,
r.laps_led
FROM nascar.main.stage_results(5601, season := 2026) s
JOIN nascar.main.race_results(5601, season := 2026) r USING (driver_id)
WHERE s.position = 1
ORDER BY s.stage_number
24 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.
- Who currently leads the points standings in each of NASCAR's three national series?
- Who won the latest NASCAR Cup race, and how many Cup races are on this year's schedule?
- Is any NASCAR session on track right now? If so, what lap and flag is it on?
- Show the top five of the 2026 Cup Series Championship Race (race 5601) with birth dates.
- Using the lead stints, who led the most laps in 2026 NASCAR race 5601, and how many?
- List each driver's number of 2025 NASCAR Cup Series points-race wins, most first.
NASCAR 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
Formula 1
Sports
F1 standings, results, calendars, lap times, and session timing as SQL tables
Cricket
Sports
Cricket matches, scorecards, ball-by-ball deliveries, standings, and ICC rankings as SQL tables
Golf
Sports
PGA Tour, DP World, LIV, LPGA, Champions and Korn Ferry leaderboards plus OWGR