Menu

TypeError: On Insert

Help
cmnorton
2010-03-05
2012-09-19
  • cmnorton

    cmnorton - 2010-03-05

    I need to build up the contents of a table with multiple passes through it.

    This partial code block produces

    TypeError: not enough arguments for format string

    Will insert not work inserting on a subset of columns, or is there something
    wrong with the syntax?

    I have a workaround, which is to execute a mysql command line.

    sql_cmd = \

    """

    INSERT INTO synth_customer_synch

    (

    MeterID, AcctID, PremiseID, CustomerID, CustomerLastName,

    CustomerFirstName, CompanyName, PremiseType, AddressLine1, AddressLine2,

    City, State, Zip, Route

    )

    VALUES

    (

    %s, %s, %s, %s, %s,

    %s, %s, %s, %s, %s,

    %s, %s, %s, %s

    )

    """

    in_row = in_cur.fetchone()

    while None != in_row:

    if in_row == None:

    continune

    lnam_fnam_l = parseLnamFnam(in_row)

    out_row = \

    in_row, in_row, in_row, in_row, lnam_fnam_l, \

    lnam_fnam_l, in_row, in_row, in_row, in_row, \

    in_row, in_row

    out_cur.execute(sql_cmd, out_row)

     
  • cmnorton

    cmnorton - 2010-03-05

    Sorry!

    out_row = \

    in_row, in_row, in_row, in_row, lnam_fnam_l, \

    lnam_fnam_l, in_row, in_row, in_row, in_row, \

    in_row, in_row

    Not 14 elements.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.