Last active
December 22, 2015 04:38
-
-
Save coffeemug/6417983 to your computer and use it in GitHub Desktop.
Importing `git log` data into RethinkDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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