Skip to content

Instantly share code, notes, and snippets.

@jj1bdx
Created March 14, 2013 08:18
Show Gist options
  • Save jj1bdx/5159722 to your computer and use it in GitHub Desktop.
Save jj1bdx/5159722 to your computer and use it in GitHub Desktop.
A crude example of dumping reversebeacon.net CSV files to Riak via riak-python-client
#!/usr/local/bin/python
import sys
import json
import csv
import riak
#client = riak.RiakClient()
cl = riak.RiakClient(host=YOURHOST, pb_port=YOUR_PB_PORT, protocol='pbc')
b = cl.bucket('records_rb')
fname = ['callsign', 'de_pfx', 'de_cont', 'freq', 'band', 'dx', 'dx_pfx', 'dx_cont', 'mode', 'db', 'date']
fn = './rb_csv/' + sys.argv[1] + '.csv'
f = open(fn, "r")
for row in csv.DictReader(f, fieldnames=fname):
item = b.new(data=row)
item.store()
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment