File size: 3,618 Bytes
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8beffc
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8beffc
5d93294
 
 
 
 
c8beffc
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
license: mit
task_categories:
  - tabular-classification
  - tabular-regression
tags:
  - campaign-finance
  - fec
  - elections
  - political-donations
  - pac
  - lobbying
  - duckdb
  - government-data
  - politics
  - united-states
pretty_name: FEC Campaign Finance Database
size_categories:
  - 100M<n<1B
---

# FEC Campaign Finance Database

A clean, queryable DuckDB database built from [FEC bulk data](https://www.fec.gov/data/browse-data/?tab=bulk-data) covering federal campaign finance filings.

**339,466,701 rows** across **10 tables** covering candidates, committees, individual contributions, PAC spending, and more.

Built with [fec-database](https://github.com/ian-nason/fec-database).

## Quick Start

### DuckDB CLI

```sql
INSTALL httpfs;
LOAD httpfs;
ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb' AS fec (READ_ONLY);

-- Top presidential candidates by individual donations (2024 cycle)
SELECT c.CAND_NAME, c.CAND_PTY_AFFILIATION AS party,
    SUM(i.TRANSACTION_AMT) AS total, COUNT(*) AS donations
FROM fec.individual_contributions i
JOIN fec.candidates c ON i.CMTE_ID = c.CAND_PCC AND i.cycle = c.cycle
WHERE i.cycle = 2024 AND c.CAND_OFFICE = 'P' AND i.TRANSACTION_AMT > 0
GROUP BY 1, 2 ORDER BY total DESC LIMIT 10;
```

### Python

```python
import duckdb
con = duckdb.connect()
con.sql("INSTALL httpfs; LOAD httpfs;")
con.sql(\"\"\"
    ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb'
    AS fec (READ_ONLY)
\"\"\")
con.sql("SELECT * FROM fec._metadata").show()
```

DuckDB uses HTTP range requests, so only the pages needed for your query are downloaded.

## Tables

| Table | Description | Rows | Cols | Cycles |
|-------|-------------|------|------|--------|
| `individual_contributions` | Every individual donation: name, employer, occupation, amount, date | 268,792,987 | 22 | 2004-2026 |
| `committee_to_committee` | Transfers between committees | 45,559,049 | 22 | 2004-2026 |
| `operating_expenditures` | Committee operating expenditures: payee, purpose, amount | 18,875,347 | 26 | 2004-2026 |
| `committee_contributions` | PAC/party contributions to candidates | 5,214,013 | 23 | 2004-2026 |
| `independent_expenditures` | Independent expenditures for/against candidates | 664,775 | 258 | 2010-2026 |
| `committees` | Committee master: name, type, party, treasurer, connected org | 183,599 | 16 | 2004-2026 |
| `candidates` | Candidate master: name, party, office, state, district, status | 76,283 | 16 | 2004-2026 |
| `candidate_committee_links` | Which committees are authorized by which candidates | 73,520 | 8 | 2004-2026 |
| `communication_costs` | Internal communications supporting/opposing candidates | 25,558 | 27 | 2010-2026 |
| `electioneering_communications` | Broadcast ads mentioning candidates near elections | 1,570 | 397 | 2010-2024 |

## Pre-built Views

| View | Description |
|------|-------------|
| `v_candidate_totals` | Candidate fundraising totals from individual contributions |
| `v_top_donors` | Aggregated donor activity across all cycles |
| `v_pac_to_candidate` | PAC-to-candidate contributions with org names |
| `v_daily_donations` | Daily donation volume and amounts |

## Data Source

[Federal Election Commission](https://www.fec.gov/data/browse-data/?tab=bulk-data). Bulk data files are public domain and updated weekly.

## License

Database build code: MIT. Underlying data: public domain (U.S. government records).

## GitHub

Full source code, build instructions, and example queries: [github.com/ian-nason/fec-database](https://github.com/ian-nason/fec-database)