sqlalchemy.exc.compileError: Unconsumed column Name

Issue #3579 invalid
mrudula chougule created an issue

Hi,

I am having python+gtk application. I'm currently porting my python application from Ubuntu 10.04 to 14.04. I have sqlalchemy version of 0.8.4-1Ubuntu2.1 on Ubuntu 14.04. When trying to run my application, when it is trying to insert column into database it is throwing this error: sqlalchemy.exc.compileError: Unconsumed column Name

Please share your views or ideas to resolve this error. I'm stuck!!

Thanks, Mrudula

Comments (5)

  1. Mike Bayer repo owner

    it means you are doing this:

    from sqlalchemy import *
    
    metadata = MetaData()
    
    table = Table(
        'table', metadata,
        Column('a', Integer),
        Column('b', Integer)
    )
    
    e = create_engine("sqlite://")
    metadata.create_all(e)
    
    e.execute(
        table.insert().values(a='foo', b='bar', c='im not a column')
    )
    

    please use the mailing list for usage questions thanks!

  2. mrudula chougule reporter

    Thank you for sharing views.

    Please find below is my function details: Function name: create_configuration_table

    create_configuration_table creates the configuration database

    from python code, rather than from schema/init files, because of the

    way it works with the data_session::session class

    def create_configuration_table(mdata=None, insert=True): # optional parameter mdata and insert are unique for usage of this function # inside data_session.py, look there for details **md = None if mdata: md = mdata else: md = metadata

    table = Table('configuration', md)**
    
    # combo boxes
    combo_boxes = ['temp_cbox', 'press_cbox', 'remote_cbox', 'comm_failure_cbox',
                   'serial_device_cbox', 'serial_baud_cbox', 'serial_parity_cbox',
                   'eth_protocol_cbox', 'anti_recycle_cbox', 'language_cbox',
                   'compressor_cbox', 'comp_model_cbox', 'refrig_cbox', 'twin_op_mode_cbox']
    
    for i in combo_boxes:
        table.append_column(col(i, TEXT))
    
    #check buttons
    check_buttons = ['serial_comm_cb', 'suct_press_cb', 'proc_control_cb', 'disch_press_cb',
                     'eth_comm_cb', 'direct_io_cb', 'comp_vfd_cb', 'comp_seq_cb',
                     'cond_control_cb', 'cond_ambient_cb', 'cond_wetbulb_cb', 'cond_vfd_cb',
                     'slide_vol_cb', 'superheat_monitor_cb', 'suction_superheat_monitor_cb',
                     'econ_press_cb', 'extra1_io_cb', 'extra2_io_cb', 'extra3_io_cb', 'extra4_io_cb',
                     'extra5_io_cb', 'digital_aux_in_enable_cb', 'digital_aux_out_enable_cb',
                     'analog_aux_in_enable_cb', 'analog_aux_out_enable_cb', 'oil_flow_control_cb',
                     'air_cooler_vfd_cb', 'email_notification_cb', 'email_trip_cb', 'email_alarm_cb',
                     'idle_trip_cb', 'rapid_cycling_vfd_cb', 'vnc_web_browser_cb', 'soi_solenoid_cb',
                     'cool_compression_cb', 'heat_pump_cb']
    
    # auxiliary check buttons
    for i in range(1, 17):
        check_buttons.append('aaux%s_in_cb' % i)
        if i < 9:
            check_buttons.append('daux%s_in_cb' % i)
            if i < 5:
                check_buttons.append('aaux%s_out_cb' % i)
                check_buttons.append('daux%s_out_cb' % i)
    
    for i in check_buttons:
        table.append_column(col(i, Integer))
    
    
    # radio buttons
    radio_buttons = ['time_format_rb', 'data_serial_bits_rb', 'stop_serial_bits_rb',
                     'direct_io_rb', 'oil_pump_select_rb', 'oil_cool_select_rb',
                     'liquid_injection_mode_rb', 'motor_current_select_rb',
                     'restart_pwr_fail_rb', 'comp_seq_rb', 'proc_control_mode_rb']
    
    for i in radio_buttons:
        table.append_column(col(i, TEXT))
    
    
    # active/non-active items
    actives = ['am_pm_cbox', 'serial_comm_box', 'eth_comm_box', 'comp_seq_vbox',
               'k_factor_box', 'cond_control_box', 'oil_pump_box', 'oil_cooling_box',
               'suct_controllers_e', 'proc_controllers_e', 'disch_controllers_e',
               'proc_control_box', 'oil_cool_solenoids_e', 'remote_air_cooler_hbox',
               'vnc_web_browser_port_hbox', 'email_notification_box', 'heat_pump_box']
    
    for i in actives:
        save_str = '%s_active' % i
        table.append_column(col(save_str, Integer))
        actives[actives.index(i)] = save_str
    
    
    # integer entries
    entries = ['eth_ip_e', 'eth_smask_e', 'eth_gateway_e']
    
    for i in range(1,17):
        entries.append('aaux%s_in_name_e' % i)
        if i < 9:
            entries.append('daux%s_in_name_e' % i)
            if i < 5:
                entries.append('aaux%s_out_name_e' % i)
                entries.append('daux%s_out_name_e' % i)
    
    for i in entries:
        table.append_column(col(i, Integer))
    
    # integer check constraint entries
    cc_entries = [['comp_pid_e', 1, 99],
                  ['order_num_e', 1, 1000000],
                  ['serial_pid_e', 1, 99],
                  ['eth_pid_e', 1, 99],
                  ['twin_cfm_e', 100, 5000],
                  ['k_factor_e', 1, 1500],
                  ['suct_controllers_e', 1, 2],
                  ['proc_controllers_e', 1, 2],
                  ['disch_controllers_e', 1, 2],
                  ['oil_pumps_e', 1, 2],
                  ['oil_cool_solenoids_e', 1, 2],
                  ['separator_factor1_e', 1, 100],
                  ['separator_factor2_e', 1, 100],
                  ['separator_factor3_e', 1, 100],
                  ['vnc_port_e', 5900, 6000],
                  ['vnc_web_browser_port_e', 5901, 6000],
                  ['discharge_pressure_e', 0, 800],
                  ['diff_pressure_e', 0, 600]]
    
    for i in cc_entries:
        table.append_column(col(i[0], Integer,
                                cc('%s >= %s' % (i[0], i[1])), cc('%s <= %s' % (i[0], i[2]))))
    
    # miscellaneous
    misc = ['extra1_io_str', 'extra2_io_str', 'extra3_io_str', 'extra4_io_str', 'extra5_io_str',
            'comp_name_e', 'comp_seq_network_name_e', 'email_to_e', 'email_from_e', 'email_server_e',
            'email_pass_e']
    
    for i in misc:
        table.append_column(col(i, TEXT))
    
    table.create()
    
    
    if insert: 
        value_dict = {}
    
        #combo boxes
        cbs = {'temp_cbox':'F', 'press_cbox':'Psig', 'remote_cbox': 'Ethernet',
               'comm_failure_cbox': 'Revert to Local Control', 'serial_device_cbox':'P12 / RS485',
               'serial_baud_cbox':'9600', 'serial_parity_cbox':'Even', 'eth_protocol_cbox':'Modbus TCP',
               'anti_recycle_cbox':'Accumulative', 'language_cbox':'English', 'compressor_cbox':'VSS',
               'comp_model_cbox':'451', 'refrig_cbox':'R717', 'twin_op_mode_cbox':'Standard'}
    
        value_dict.update(cbs)
    
        # radio buttons
        rbs = {'time_format_rb': '12 hour', 'data_serial_bits_rb':'8', 'stop_serial_bits_rb':'1',
               'direct_io_rb':'Auto Capacity', 'oil_pump_select_rb':'Full Time',
               'oil_cool_select_rb':'Liquid Injection', 'liquid_injection_mode_rb':'Solenoids',
               'motor_current_select_rb':'Current Transformer', 'restart_pwr_fail_rb':'Never',
               'comp_seq_rb':'Slave', 'proc_control_mode_rb':'Temperature'}
        value_dict.update(rbs)
    
    
        #check buttons
        for i in check_buttons:
            value_dict[i] = 0
        value_dict['suct_press_cb'] = 1
    
        # active/non-active widgets
        for i in actives:
            value_dict[i] = 0
        value_dict['oil_pump_box_active'] = 1
        value_dict['oil_cooling_box_active'] = 1
        value_dict['suct_controllers_e_active'] = 1
        value_dict['am_pm_cbox_active'] = 1
        **value_dict['liquid_injection_type_cbox_active'] = 1**
        value_dict['oil_cool_solenoids_e_active'] = 1
    
    
        # entries
        for i in entries:
            if 'daux' in i :
                splt = i.split('_')
                value_dict[i] = 'Digital Aux ' + splt[1] + ' ' + splt[0][-1]
            elif 'aaux' in i :
                splt = i.split('_')
                if len(splt[0]) == 6:
                    dig = -2
                else:
                    dig = -1
                value_dict[i] = 'Analog Aux ' + splt[1] + ' ' + splt[0][dig:]
    
        for i in cc_entries:
            value_dict[i[0]] = i[1]
    
        # entry defaults
        value_dict['eth_ip_e'] = '1.1.1.2'
        value_dict['eth_smask_e'] = '255.0.0.0'
        value_dict['eth_gateway_e'] = '1.1.1.1'
        value_dict['comp_name_e'] = ''
        value_dict['comp_seq_network_name_e'] = ''
        value_dict['email_to_e'] = ''
        value_dict['email_from_e'] = ''
        value_dict['email_server_e'] = ''
        value_dict['email_pass_e'] = ''
        value_dict['vnc_port_e'] = 5900
        value_dict['vnc_web_browser_port_e'] = 5901
        value_dict['twin_cfm_e'] = 600
        value_dict['discharge_pressure_e'] = 460
        value_dict['diff_pressure_e'] = 380
    
        table.insert(values=value_dict).execute()
    
    return table
    

    value_dict['liquid_injection_type_cbox_active'] = 1 this perticular column not able to insert. it is giving error as:

    sqlalchemy.exc.compileError: Unconsumed column Name liquid_injection_type_cbox_active

    Please advise correction. Unable to access mailing list for usage questions. Appreciate your help!

    Thanks, Mrudula

  3. mrudula chougule reporter

    Hi,

    Thanks for sharing views!

    Could you please advise on usage of sqlalchemy. I'm stuck because of this error from long time.

    Here is my function definition:

    def create_configuration_table(mdata=None, insert=True):

    *md = None if mdata: md = mdata else: md = metadata *

    table = Table('configuration', md)

    # combo boxes combo_boxes = ['temp_cbox', 'press_cbox', 'remote_cbox', 'comm_failure_cbox', 'serial_device_cbox', 'serial_baud_cbox', 'serial_parity_cbox', 'eth_protocol_cbox', 'anti_recycle_cbox', 'language_cbox', 'compressor_cbox', 'comp_model_cbox', 'refrig_cbox', 'twin_op_mode_cbox']

    for i in combo_boxes: table.append_column(col(i, TEXT))

    #check buttons check_buttons = ['serial_comm_cb', 'suct_press_cb', 'proc_control_cb', 'disch_press_cb', 'eth_comm_cb', 'direct_io_cb', 'comp_vfd_cb', 'comp_seq_cb', 'cond_control_cb', 'cond_ambient_cb', 'cond_wetbulb_cb', 'cond_vfd_cb', 'slide_vol_cb', 'superheat_monitor_cb', 'suction_superheat_monitor_cb', 'econ_press_cb', 'extra1_io_cb', 'extra2_io_cb', 'extra3_io_cb', 'extra4_io_cb', 'extra5_io_cb', 'digital_aux_in_enable_cb', 'digital_aux_out_enable_cb', 'analog_aux_in_enable_cb', 'analog_aux_out_enable_cb', 'oil_flow_control_cb', 'air_cooler_vfd_cb', 'email_notification_cb', 'email_trip_cb', 'email_alarm_cb', 'idle_trip_cb', 'rapid_cycling_vfd_cb', 'vnc_web_browser_cb', 'soi_solenoid_cb', 'cool_compression_cb', 'heat_pump_cb']

    auxiliary check buttons

    for i in range(1, 17): check_buttons.append('aaux%s_in_cb' % i) if i < 9: check_buttons.append('daux%s_in_cb' % i) if i < 5: check_buttons.append('aaux%s_out_cb' % i) check_buttons.append('daux%s_out_cb' % i)

    for i in check_buttons: table.append_column(col(i, Integer))

    radio buttons

    radio_buttons = ['time_format_rb', 'data_serial_bits_rb', 'stop_serial_bits_rb', 'direct_io_rb', 'oil_pump_select_rb', 'oil_cool_select_rb', 'liquid_injection_mode_rb', 'motor_current_select_rb', 'restart_pwr_fail_rb', 'comp_seq_rb', 'proc_control_mode_rb']

    for i in radio_buttons: table.append_column(col(i, TEXT))

    active/non-active items

    actives = ['am_pm_cbox', 'serial_comm_box', 'eth_comm_box', 'comp_seq_vbox', 'k_factor_box', 'cond_control_box', 'oil_pump_box', 'oil_cooling_box', 'suct_controllers_e', 'proc_controllers_e', 'disch_controllers_e', 'proc_control_box', 'oil_cool_solenoids_e', 'remote_air_cooler_hbox', 'vnc_web_browser_port_hbox', 'email_notification_box', 'heat_pump_box']

    for i in actives: save_str = '%s_active' % i table.append_column(col(save_str, Integer)) actives[actives.index(i)] = save_str

    integer entries

    entries = ['eth_ip_e', 'eth_smask_e', 'eth_gateway_e']

    for i in range(1,17): entries.append('aaux%s_in_name_e' % i) if i < 9: entries.append('daux%s_in_name_e' % i) if i < 5: entries.append('aaux%s_out_name_e' % i) entries.append('daux%s_out_name_e' % i)

    for i in entries: table.append_column(col(i, Integer))

    integer check constraint entries

    cc_entries = [['comp_pid_e', 1, 99], ['order_num_e', 1, 1000000], ['serial_pid_e', 1, 99], ['eth_pid_e', 1, 99], ['twin_cfm_e', 100, 5000], ['k_factor_e', 1, 1500], ['suct_controllers_e', 1, 2], ['proc_controllers_e', 1, 2], ['disch_controllers_e', 1, 2], ['oil_pumps_e', 1, 2], ['oil_cool_solenoids_e', 1, 2], ['separator_factor1_e', 1, 100], ['separator_factor2_e', 1, 100], ['separator_factor3_e', 1, 100], ['vnc_port_e', 5900, 6000], ['vnc_web_browser_port_e', 5901, 6000], ['discharge_pressure_e', 0, 800], ['diff_pressure_e', 0, 600]]

    for i in cc_entries: table.append_column(col(i[0], Integer, cc('%s >= %s' % (i[0], i[1])), cc('%s <= %s' % (i[0], i[2]))))

    miscellaneous

    misc = ['extra1_io_str', 'extra2_io_str', 'extra3_io_str', 'extra4_io_str', 'extra5_io_str', 'comp_name_e', 'comp_seq_network_name_e', 'email_to_e', 'email_from_e', 'email_server_e', 'email_pass_e']

    for i in misc: table.append_column(col(i, TEXT))

    table.create()

    if insert: value_dict = {}

    #combo boxes
    cbs = {'temp_cbox':'F', 'press_cbox':'Psig', 'remote_cbox': 'Ethernet',
           'comm_failure_cbox': 'Revert to Local Control',
    

    'serial_device_cbox':'P12 / RS485', 'serial_baud_cbox':'9600', 'serial_parity_cbox':'Even', 'eth_protocol_cbox':'Modbus TCP', 'anti_recycle_cbox':'Accumulative', 'language_cbox':'English', 'compressor_cbox':'VSS', 'comp_model_cbox':'451', 'refrig_cbox':'R717', 'twin_op_mode_cbox':'Standard'}

    value_dict.update(cbs)
    
    # radio buttons
    rbs = {'time_format_rb': '12 hour', 'data_serial_bits_rb':'8',
    

    'stop_serial_bits_rb':'1', 'direct_io_rb':'Auto Capacity', 'oil_pump_select_rb':'Full Time', 'oil_cool_select_rb':'Liquid Injection', 'liquid_injection_mode_rb':'Solenoids', 'motor_current_select_rb':'Current Transformer', 'restart_pwr_fail_rb':'Never', 'comp_seq_rb':'Slave', 'proc_control_mode_rb':'Temperature'} value_dict.update(rbs)

    #check buttons
    for i in check_buttons:
        value_dict[i] = 0
    value_dict['suct_press_cb'] = 1
    
    # active/non-active widgets
    for i in actives:
        value_dict[i] = 0
    value_dict['oil_pump_box_active'] = 1
    value_dict['oil_cooling_box_active'] = 1
    value_dict['suct_controllers_e_active'] = 1
    value_dict['am_pm_cbox_active'] = 1
    *value_dict['liquid_injection_type_cbox_active'] = 1*
    value_dict['oil_cool_solenoids_e_active'] = 1
    
    # entries
    for i in entries:
        if 'daux' in i :
            splt = i.split('_')
            value_dict[i] = 'Digital Aux ' + splt[1] + ' ' + splt[0][-1]
        elif 'aaux' in i :
            splt = i.split('_')
            if len(splt[0]) == 6:
                dig = -2
            else:
                dig = -1
            value_dict[i] = 'Analog Aux ' + splt[1] + ' ' + splt[0][dig:]
    
    for i in cc_entries:
        value_dict[i[0]] = i[1]
    
    # entry defaults
    value_dict['eth_ip_e'] = '1.1.1.2'
    value_dict['eth_smask_e'] = '255.0.0.0'
    value_dict['eth_gateway_e'] = '1.1.1.1'
    value_dict['comp_name_e'] = ''
    value_dict['comp_seq_network_name_e'] = ''
    value_dict['email_to_e'] = ''
    value_dict['email_from_e'] = ''
    value_dict['email_server_e'] = ''
    value_dict['email_pass_e'] = ''
    value_dict['vnc_port_e'] = 5900
    value_dict['vnc_web_browser_port_e'] = 5901
    value_dict['twin_cfm_e'] = 600
    value_dict['discharge_pressure_e'] = 460
    value_dict['diff_pressure_e'] = 380
    
    table.insert(values=value_dict).execute()
    

    return table

    1.

    value_dict['liquid_injection_type_cbox_active'] = 1 this perticular column not able to insert. it is giving error as:

    sqlalchemy.exc.compileError: Unconsumed column Name liquid_injection_type_cbox_active

    Please advise correction. Unable to access mailing list for usage questions. Appreciate your help!

    Thanks, Mrudula

  4. Log in to comment