You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e8b97fd
Browse filesBrowse the repository at this point in the historyBrowse files
feat: register browser-downloaded bulk files, read them offline, and read CRDF workbooks (#72)
register_bulk_file() puts a bulk file downloaded in a browser into the
cache under the key a download would use, and BulkDownloadChallengeError
prints that call. The CRS, DAC1, DAC2a, DAC2b and multisystem bulk
readers and bulk_download_parquet take offline=True, which reads the
cached copy with no network call. An expired download is deleted only
once a newer copy of the same dataset is cached. The new oda_reader.crdf
module reads the OECD climate-related development finance workbooks
into one set of columns with file provenance. The docs state that
scripted access to the OECD bulk files is not a committed service.
Copy file name to clipboardExpand all lines: docs/docs/bulk-downloads.md
+79-9Lines changed: 79 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,25 @@ For large-scale analysis, bulk downloads are faster and more reliable than repea
23
23
- Exploratory analysis with changing queries
24
24
- You only need recent data
25
25
26
+
## How ODA Reader fetches bulk files
27
+
28
+
OECD publishes the bulk files on `webfs-dcd.oecd.org`. ODA Reader downloads each file whole,
29
+
keeps a local copy in the [bulk file cache](caching.md#bulk-file-cache) and answers every query
30
+
from that copy. It never reads a bulk file remotely.
31
+
32
+
Before a download, ODA Reader sends one single-byte request to read the file's version token
33
+
(its `ETag`, or `Last-Modified` when no `ETag` is sent). It downloads the file only when it has
34
+
no copy, when the token has changed, or when the copy is past its 90-day TTL. Otherwise it reads
35
+
the copy it has. See [Cache invalidation on republish](caching.md#cache-invalidation-on-republish).
36
+
37
+
OECD may change bulk file names, for example by adding a timestamp. ODA Reader does not hard-code
38
+
them. On each online read it looks up the current file name in the SDMX dataflow annotations,
39
+
and an offline read finds the cached copy by dataset, whatever name it was stored under.
40
+
41
+
A scripted request can meet a Cloudflare challenge; see
42
+
[Cloudflare challenge](#cloudflare-challenge-bulkdownloadchallengeerror). The supported route
43
+
then is to download the file in a browser and pass it to `register_bulk_file`.
44
+
26
45
## CRS bulk downloads
27
46
28
47
The full Creditor Reporting System dataset is available as a bare parquet file (1.18 GB, not zipped). ODA Reader can download and load it for you.
@@ -450,20 +469,71 @@ See [DAC2b bulk download](#dac2b-bulk-download) above for the full column list a
450
469
451
470
**Slow download**: Bulk downloads depend on OECD's file server speed. Try again later if slow. Once downloaded, files are cached. Each attempt has a 10-second connect / 60-second read timeout, so a stalled connection fails with an error.
**HTTP 429 or 503**: When the file server answers with a `Retry-After` of 300 seconds or less, ODA Reader waits that long and tries again, up to three times. A longer wait, a missing `Retry-After`, or a fourth throttled response raises `BulkDownloadHTTPError`, and its `retry_after` attribute holds the wait the server asked for in seconds.
454
473
455
-
Cloudflare can require an interactive browser check on an OECD bulk-file
456
-
request. These checks require browser execution. ODA Reader raises
457
-
`BulkDownloadChallengeError` and includes the `cf_ray` value supplied by
458
-
OECD/Cloudflare. Include that value when reporting the failure to OECD.
0 commit comments