bag_to_sql.py
Go to the documentation of this file.
00001 import sqlite3
00002 import numpy as np
00003 import pickle as pk
00004 
00005 #tables will be of the form
00006 ## Table given a topic name - /some/path/to/topic_a => ?
00007 # Time Message
00008 
00009 def create_raw_table(topic_name, cur):
00010     cur.execute("CREATE TABLE raw_data (id text PRIMARY KEY," \
00011                     + "surface_id integer, "\
00012                     + "surface_height real, " \
00013                     + "unrotated_points matrix, " \
00014                     + "normal matrix, " \
00015                     + "labels matrix, " \
00016                     + "image text, "  \
00017                     + "intensities matrix, "  \
00018                     + "points matrix)")
00019 
00020 
00021 def pickle_adapter(some_obj):
00022     return pk.dumps(some_obj)
00023 
00024 def pickle_converter(pkl_str):
00025     try:
00026         if len(pkl_str) == 0:
00027             print "pickle_converter: WARNING -- encountered string of length 0"
00028             return None
00029         return pk.loads(pkl_str)
00030     except EOFError, e:
00031         import pdb
00032         pdb.set_trace()
00033         print 'error'
00034     except ValueError, e:
00035         import pdb
00036         pdb.set_trace()
00037         print 'error'
00038         return None
00039 


hai_sandbox
Author(s): Hai Nguyen
autogenerated on Wed Nov 27 2013 11:46:56