Skip to main content

gdelt-tui

Download the GDELT Global Database of Events and store it as partitioned Parquet, from a terminal UI.

pip install gdelt-tui
gdelt-tui

The TUI asks which table you want, which date range, and where to save, then shows per-file progress while it downloads and converts. q aborts after the file in flight.

The three tables

GDELT publishes the event table in three shapes. All three are supported.

Key Table Range Columns Notes
events 1.0 events, daily 2013-04-01 → today 58 ~7MB per day, no header
history events, monthly/yearly 1979 → 2013-03 57 same as events minus SOURCEURL
master MASTERREDUCED V2 1979 → 2013 17 aggregated, 1.1GB, has a header

Non-interactive use

Every flag works without the TUI, which is what you want in a script or cron job. Progress falls back to plain lines when stdout is not a terminal.

# last 7 days of events, the default window
gdelt-tui --dataset events

# an explicit range
gdelt-tui --dataset events --start 2024-01-01 --end 2024-01-31

# one month of history
gdelt-tui --dataset history --start 1979-01-01 --end 1979-01-31
Flag Meaning
-d, --dataset events, history or master
--start, --end YYYY-MM-DD; a file is included if its period overlaps
-o, --output root directory, default ./gdelt-data
--batch-size rows per Parquet part, default 250000
--no-tui force plain output
--reconvert re-convert files that are already downloaded

Output layout

gdelt-data/
  raw/                                  zips, kept so you can reconvert
    events/2024/20240115.export.CSV.zip
  parquet/
    year=2024/date=2024-01-15/part-00000.parquet
    year=1979/part-00000.parquet

Hive-style partitioning, so Polars, pandas and DuckDB can scan a range without loading it all:

import polars as pl

events = pl.scan_parquet("gdelt-data/parquet", hive_partitioning=True).filter(
    pl.col("date") >= pl.date(2024, 1, 1)
)
-- DuckDB
SELECT Actor1CountryCode, count(*)
FROM read_parquet('gdelt-data/parquet/**/*.parquet', hive_partitioning=true)
WHERE year = 2024 AND QuadClass = 1
GROUP BY 1 ORDER BY 2 DESC LIMIT 10;

Library use

from datetime import date
from pathlib import Path

from gdelt_tui import BY_KEY, convert, download, fetch_index, select

events = BY_KEY["events"]
raw, out = Path("raw"), Path("parquet")

for entry in select(fetch_index(), events, date(2024, 3, 1), date(2024, 3, 2)):
    archive = raw / entry.name
    download(entry.url, archive, expected=entry.md5)
    convert(archive, events, out, period=entry.period)

Integrity

Every file carries an MD5 on the GDELT index page, so downloads are verified before the .part file is renamed into place. A file that fails its checksum is retried, then reported and skipped rather than aborting the run.

A note on the compiled wheel

The TUI is a Rust extension (ratatui via PyO3), which is what keeps the installed package to one dependency, polars, with no Python TUI libraries.

The trade-off is that this is a platform wheel, not a pure-Python package. pip install from a wheel is instant. Installing from the sdist — on musl Linux, on a platform without a published wheel, or from a source checkout — compiles the extension and therefore needs a Rust toolchain present. Building takes a couple of minutes.

License

MIT

Metadata

Release files for gdelt-tui 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gdelt-tui 0.1.0
File Size Uploaded Provenance Actions
gdelt_tui-0.1.0.tar.gz 33.7 kB Without provenance Details for gdelt_tui-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gdelt-tui 0.1.0
File Interpreter ABI Platform Actions
gdelt_tui-0.1.0-cp39-abi3-manylinux_2_39_x86_64.whl CPython 3.9 abi3 Linux glibc 2.39+ x86-64 Details for gdelt_tui-0.1.0-cp39-abi3-manylinux_2_39_x86_64.whl

Total release size: 484.7 kB

Release files / gdelt_tui-0.1.0.tar.gz

Download URL gdelt_tui-0.1.0.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
117a3ebf9bfc5b6346a3b860e736c9db6abaec839f67e41661086d211daaa1a2
BLAKE2b-256 checksum
How to use checksums
5b4260e65ba8c8883beefc4e5b6f406d00aab1f747d8130a31080dc1b2e17820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / gdelt_tui-0.1.0-cp39-abi3-manylinux_2_39_x86_64.whl

Download URL gdelt_tui-0.1.0-cp39-abi3-manylinux_2_39_x86_64.whl
Size 451.0 kB
Tags CPython 3.9 Linux glibc 2.39+ x86-64 abi3
SHA-256 checksum
How to use checksums
e476925cc9a6e3a069853999ef108d05be7f96969a89cfa755e26c85a0f1b781
BLAKE2b-256 checksum
How to use checksums
71cc506cc34730a432c2b0a751ff8a152c8f739c22641741ee1ff35f3dfbe67c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for gdelt-tui 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page