Hi, I have a little problem with column names that start with a digit at an oracle databases which I inherited. When I try to do and update/insert with values from a dict like this i.e.: ---8<-- engine =create_engine('oracle+cx_oracle://<foobar>') engine.echo = True
Session = sessionmaker(bind=engine) session = Session() metadata = MetaData() metadata.bind = engine site_tbl = Table('TBL_SITE', metadata, autoload = True, schema='foo' ) pks = {'Site_Id':5772} vals= {'100K_Name':'Foo','Accuracy':'Bar'} clauses = [site_tbl.c[k]==v for k,v in pks.iteritems()] update = site_tbl.update().where(and_(*clauses)) session.execute(update,vals) session.commit() ---8<--- I get this error: ---8<--- DatabaseError: (DatabaseError) ORA-01036: illegal variable name/number 'UPDATE foo."TBL_SITE" SET "100K_Name"=:100K_Name, "Accuracy_Method"=:Accuracy_Method WHERE foo."TBL_SITE"."Site_Id" = :Site_Id_1' {'Site_Id_1': 5772, '100K_Name': 'Foo', 'Accuracy': 'Bar'} ---8<--- The problem is that the bindname ':100K_Name'. Something like this: ---8<--- myupdate='UPDATE foo."TBL_SITE" SET "100K_Name"=:bv0, "Accuracy"=:Accuracy_Method WHERE "Site_Id" = :Site_Id' myvals={'Site_Id':5772,'Accuracy_Method ':'Bar','bv0':'Foo'} session.execute(text(myupdate),myvals) ---8<--- works fine but I really would like to know if there is a way to let SA handle these column names binds automatically? ( It would make things a lot easier for me as the vals dict is generated dynamically. ) Kind Regards, Sirko -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.