Skip to content

Instantly share code, notes, and snippets.

View hannesdatta's full-sized avatar
🚩
https://tilburgsciencehub.com

Hannes Datta hannesdatta

🚩
https://tilburgsciencehub.com
View GitHub Profile
@hannesdatta
hannesdatta / mongo_chunk.py
Created November 29, 2019 12:07 — forked from kenju254/mongo_chunk.py
Python script that can export Mongo collections of any size into progressive numbered json chunks, type `python mongo_chunk.py --help` to have a list of available options
#!/usr/bin/python
import argparse
from pymongo import MongoClient as Client
from bson import BSON
from bson import json_util
import json
import os
# mongo client
# Load packages
library(tidyverse)
library(reshape2)
# DOWNLOAD DATA
## Function to download data and save as CSV
download_data <- function(url, filename){
download.file(url = url, destfile = paste0(filename, ".csv"))
}