Rick, On Jan 15, 1:34 pm, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Two issues: > a) You need to give SA a table definition for the table you're trying to > update. > b) You need to specify the name of the column to update in the dict(), not > the string 'key' > > I've updated the script to work by passing in both the column name to update > and the update value to use. I've made my changes in bold below: > > def main(*key, val*): > engine = create_engine('mssql://dbName:[EMAIL PROTECTED]') * # No table > name in > URI !! /%s' % tblName)*
I actually had this right in my code, but I posted it incorrectly when sanitizing it for the newsgroup. > conn = engine.connect() > > # create MetaData > meta = MetaData() > > # bind to an engine > meta.bind = engine > * > # specify table definition > tbl = Table('tbl_Acct_prefs', meta, > Column('netname', VARCHAR(20)), > Column('pref_name', VARCHAR(40)), > Column('pref_value', VARCHAR(40)) > )* > > # create metadata > *#* meta.create_all() * # <=== you need this only if you're creating > the table with your program* I was following the docs on the website for this one...I guess I misunderstood since their example was using a sqlite database in memory. Oh well... > > tbl.update(tbl.c.netname=='saw').execute(*{key:val}*) This worked. Thank you for your patience and for sharing your knowledge. Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---