labpack/databases/sql.py
def _construct_columns(self, column_map):
        
        ''' a helper method for constructing the column objects for a table object '''
        
        from sqlalchemy import Column, String, Boolean, Integer, Float, Binary 
    
        column_args = []
        for key, value in column_map.items():
            record_key = value[0]
            datatype = value[1]
            max_length = value[2]
            if record_key == 'id':
                if datatype in ('string', 'float', 'integer'):
                    if datatype == 'string':
                        if max_length:
                            column_args.insert(0, Column(record_key, String(max_length), primary_key=True))
                        else:
                            column_args.insert(0, Column(record_key, String, primary_key=True))
                    elif datatype == 'float':
                        column_args.insert(0, Column(record_key, Float, primary_key=True))
                    elif datatype == 'integer':
                        column_args.insert(0, Column(record_key, Integer, primary_key=True))
                else:
                    raise ValueError('Field "id" in record_schema must be a string, float or integer.')
            else:
                if datatype == 'boolean':
                    column_args.append(Column(record_key, Boolean))
                elif datatype == 'string':
                    if max_length:
                        column_args.append(Column(record_key, String(max_length)))
                    else:
                        column_args.append(Column(record_key, String))
                elif datatype == 'float':
                    column_args.append(Column(record_key, Float))
                elif datatype == 'integer':
                    column_args.append(Column(record_key, Integer))
                elif datatype == 'list':
                    column_args.append(Column(record_key, Binary))
        
        return column_args
 a helper method for constructing the column objects for a table object 
a helper method for constructing the column objects for a table object
a helper method for constructing the column objects for a table object
def _construct_columns(self, column_map):
        from sqlalchemy import Column, String, Boolean, Integer, Float, Binary 
        column_args = []
        for key, value in column_map.items():
            record_key = value[0]
            datatype = value[1]
            max_length = value[2]
            if record_key == 'id':
                if datatype in ('string', 'float', 'integer'):
                    if datatype == 'string':
                        if max_length:
                            column_args.insert(0, Column(record_key, String(max_length), primary_key=True))
                        else:
                            column_args.insert(0, Column(record_key, String, primary_key=True))
                    elif datatype == 'float':
                        column_args.insert(0, Column(record_key, Float, primary_key=True))
                    elif datatype == 'integer':
                        column_args.insert(0, Column(record_key, Integer, primary_key=True))
                else:
                    raise ValueError('Field "id" in record_schema must be a string, float or integer.')
            else:
                if datatype == 'boolean':
                    column_args.append(Column(record_key, Boolean))
                elif datatype == 'string':
                    if max_length:
                        column_args.append(Column(record_key, String(max_length)))
                    else:
                        column_args.append(Column(record_key, String))
                elif datatype == 'float':
                    column_args.append(Column(record_key, Float))
                elif datatype == 'integer':
                    column_args.append(Column(record_key, Integer))
                elif datatype == 'list':
                    column_args.append(Column(record_key, Binary))
        return column_args
def _construct_columns ( self , column_map ) : from sqlalchemy import Column , String , Boolean , Integer , Float , Binary column_args = [ ] for key , value in column_map . items ( ) : record_key = value [ 0 ] datatype = value [ 1 ] max_length = value [ 2 ] if record_key == 'id' : if datatype in ( 'string' , 'float' , 'integer' ) : if datatype == 'string' : if max_length : column_args . insert ( 0 , Column ( record_key , String ( max_length ) , primary_key = True ) ) else : column_args . insert ( 0 , Column ( record_key , String , primary_key = True ) ) elif datatype == 'float' : column_args . insert ( 0 , Column ( record_key , Float , primary_key = True ) ) elif datatype == 'integer' : column_args . insert ( 0 , Column ( record_key , Integer , primary_key = True ) ) else : raise ValueError ( 'Field "id" in record_schema must be a string, float or integer.' ) else : if datatype == 'boolean' : column_args . append ( Column ( record_key , Boolean ) ) elif datatype == 'string' : if max_length : column_args . append ( Column ( record_key , String ( max_length ) ) ) else : column_args . append ( Column ( record_key , String ) ) elif datatype == 'float' : column_args . append ( Column ( record_key , Float ) ) elif datatype == 'integer' : column_args . append ( Column ( record_key , Integer ) ) elif datatype == 'list' : column_args . append ( Column ( record_key , Binary ) ) return column_args
a helper method for constructing the column objects for a table object
a helper method for constructing the column objects for a table object
''' a helper method for constructing the column objects for a table object '''
self
column_map