code: def db_schema(db, table):
    
    typedict = [('int', int), ('double', float),
                ('timestamp', datetime),
                ('date', date), ('time', dttime),
                ('text', str), ('char', str)]
    ret = {}
    q = '''select column_name, data_type
            from information_schema.columns
            where table_name = %s;'''
    #q = """select c.name, c.type from sys.columns as c, sys.tables as t where table_id = t.id and t.name = %s;"""
    # and data_type != 'date' and position('time' in data_type) =
    # 0 and column_name != 'humidity'
    for row in query(db, q, (table,)):
        name, dtype = tuple( row[:2] )
        name = str(name)
        for tn, tt in typedict:
            if tn in dtype:
                ret[name] = tt
                break
        if name not in ret:
            msg = "can't find type of %s\t%s"
            raise RuntimeError(msg % (name, dtype))
    return ret
docs: only works for postgres
  
    @return dictionary of column name -> data type