Exemplo n.º 1
0
def createThresholdsTable(table_name):
    data = createThresholds(table_name)
    fields = getSchemaFields('thresholds')       
    body = getBody(data.getvalue(), fields, 'thresholds', 'data'
                               , createDisposition='CREATE_IF_NEEDED'
                               , writeDisposition='WRITE_APPEND')
    loadTableFromCSV(body)
Exemplo n.º 2
0
def upload_codebook(left, right, dataset, cdbkfeat, task, distL, distR):
    data = cStringIO.StringIO()
    fields = myBQ.getSchemaFields('codebooks')  
    #dataset, date, hand, task, features, distortion, jsoncdbk
    data.write('{0},{1},{2},{3},{4},{5},"{6}"\n'.format(dataset, '10-OCT-2012 1:33', 'left',  task, cdbkfeat, distL, json.dumps(left[0].tolist())))   
    data.write('{0},{1},{2},{3},{4},{5},"{6}"\n'.format(dataset, '10-OCT-2012 1:33', 'right', task, cdbkfeat, distR, json.dumps(right[0].tolist())))

    body = myBQ.getBody(data.getvalue(), fields, 'codebooks', 'data'
                              , createDisposition='CREATE_IF_NEEDED'
                              , writeDisposition='WRITE_APPEND')
    myBQ.loadTableFromCSV(body)
Exemplo n.º 3
0
def upload_features(features, date, dataset, hand=None, task=None, tablename=None):
    data = cStringIO.StringIO()
    fields = myBQ.getSchemaFields(tablename)
    for k, v in features.iteritems():
        for row in v:
            data.write('{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}\n'.format(k, row[0], 
                    row[1], row[2], row[3], row[4], row[5], row[6], row[7], date, dataset, hand, task))
                       
    body = myBQ.getBody(data.getvalue(), fields, tablename, 'data'
                            , createDisposition='CREATE_IF_NEEDED'
                            , writeDisposition='WRITE_APPEND')
    myBQ.loadTableFromCSV(body)