#NEWLINE# def execute( args , parser ) : #NEWLINE# #INDENT# config = Config ( buf . config , verbose = False ) #NEWLINE# session = config . trials ( ) #NEWLINE# columns = Trial . __mapper__ . columns #NEWLINE# if ( args . output == 'json' ) : #NEWLINE# #INDENT# items = [ curr . to_dict ( ) for curr in session . query ( Trial ) . all ( ) ] #NEWLINE# value = json . dumps ( items ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . output == 'csv' ) : #NEWLINE# #INDENT# buf = cStringIO ( ) #NEWLINE# outcsv = csv . writer ( buf ) #NEWLINE# outcsv . writerow ( [ column . name for column in columns ] ) #NEWLINE# for curr in session . query ( Trial ) . all ( ) : #NEWLINE# #INDENT# row = [ getattr ( curr , column . name ) for column in columns ] #NEWLINE# outcsv . writerow ( row ) #NEWLINE# #UNINDENT# value = buf . getvalue ( ) #NEWLINE# #UNINDENT# #UNINDENT# print ( value ) #NEWLINE# return value