- def details_by_subject (self, subject):
- return self.hash_by_subject[subject]
+ rows = rows_result.ok_value()
+# API errors will be handled by the outer logic
+# if not rows:
+# print "Failed to retrieve metadata",rows_result.error()
+# rows=[]
+ self.hash_by_object = dict ( [ (row['table'], row) for row in rows ] )
+ # save for next time we use offline mode
+ if debug and rows:
+ with file(offline_filename,'w') as f:
+ f.write(json.dumps(self.hash_by_object))
+
+ def to_json(self):
+ return json.dumps(self.hash_by_object)