Skip to content

Instantly share code, notes, and snippets.

@richard-orr
richard-orr / flatten-openalex-jsonl.py
Last active March 15, 2023 02:27
flatten openalex JSON Lines files to CSV readable by PostgreSQL
import csv
import glob
import gzip
import json
import os
SNAPSHOT_DIR = 'openalex-snapshot'
CSV_DIR = 'csv-files'
FILES_PER_ENTITY = int(os.environ.get('OPENALEX_DEMO_FILES_PER_ENTITY', '0'))