Created
August 21, 2013 07:27
-
-
Save sampottinger/6291309 to your computer and use it in GitHub Desktop.
Pycotracer mongo aggregation example
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
import pycotracer | |
import pymongo | |
client = pymongo.MongoClient() | |
db = client['tracer-records-db'] | |
all_data = pycotracer.get_report(2013) | |
contribution_data = all_data['ContributionData'][:100] | |
expenditure_data = all_data['ExpenditureData'][:100] | |
loan_data = all_data['LoanData'][:100] | |
for record in contribution_data: | |
pycotracer.mongo_aggregator.update_contribution_entry(db, record) | |
for record in expenditure_data: | |
pycotracer.mongo_aggregator.update_expenditure_entry(db, record) | |
for record in loan_data: | |
pycotracer.mongo_aggregator.update_loan_entry(db, record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment