Skip to content

Instantly share code, notes, and snippets.

@coffeemug
Last active December 22, 2015 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coffeemug/6417983 to your computer and use it in GitHub Desktop.
Save coffeemug/6417983 to your computer and use it in GitHub Desktop.
Importing `git log` data into RethinkDB
git log --pretty=format:"%H|%ae|%at|%s" | \
python -c " \
import rethinkdb as r; \
import sys; \
r.connect().repl(); \
r.table_create('commits').run(); \
r.table('commits').insert([dict(map(lambda x, y: [x, y], \
['id', 'email', 'date', 'subject'], \
line.split('|', 3))) \
for line in sys.stdin]) \
.run(durability='soft'); \
r.table('commits') \
.update({'date': r.epoch_time(r.row['date'].coerce_to('number')) }) \
.run(durability='soft');"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment