From 8fcfe4081c5e616f0126667a030a4e5b7545c2a9 Mon Sep 17 00:00:00 2001 From: Norbert Winklareth Date: Sun, 30 Nov 2014 16:55:32 -0500 Subject: [PATCH] #455 - added displaying of stats --- .gitignore | 1 + countyapi/management/commands/iloaddata.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index c5fbc3a..56823b3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ include lib .Python .idea +*~ diff --git a/countyapi/management/commands/iloaddata.py b/countyapi/management/commands/iloaddata.py index 5cfe5c6..7599477 100644 --- a/countyapi/management/commands/iloaddata.py +++ b/countyapi/management/commands/iloaddata.py @@ -57,12 +57,23 @@ def handle(self, *args, **options): self.__populate_database(FIRST_PASS_MODELS) self.__populate_database(SECOND_PASS_MODELS) + + self.__display_stats() + print 'Incremental loading took %f seconds.' % (time.clock() - beginning) def __activate_json_parser(self): self.__jsonParser = ijson.parse(open(self.__jsonFileName, 'r')) self.__jsonParser.next() # skip over the start of the list + def __display_stats(self): + print "Num Charges History processed: %d" % self.__num_charges_history + print "Num County Inmates processed: %d" % self.__num_county_inmates + print "Num Court Dates processed: %d" % self.__num_court_dates + print "Num Court Locations processed: %d" % self.__num_court_location + print "Num Housing Locations processed: %d" % self.__num_housing_location + print "Num Housing History processed: %d" % self.__num_housing_history + def __fetch_db_entry(self, models_to_populate): db_entry = None while db_entry is None: