Well, in python, I believe that you can cause the interpreter to use a dict as the arguments by dereferencing it.
ie: someparams=dict(hi='there',whatever='somethingelse') query.select_by(**someparams) That work for you? -Dennis On Oct 16, 12:00 pm, "Rick S." <[EMAIL PROTECTED]> wrote: > I want to be able to dynamically generate selection contraints. > However, at the final step where I pass a generated parameter list to > the select-by() statement, I am getting errors. Any suggestions would > be appreciated. > > This works fine: > ormHostList = query.select_by(osplatform = 'win32', osnameversid = > 8) > > 1) I tried passing in the parameters as a list. > fooList = ["osplatform = 'win32'", "osnameversid = 8"] > ormHostList = query.select_by(fooList) > > That resulted in: > "T:\win32\python-2.4.3\lib\site-packages\sqlalchemy-0.2.8-py2.4.egg\sqlalchemy\sql.py", > line 1508, in _append_condition > AttributeError: 'list' object has no attribute 'accept_visitor' > > 2) So, how about a string? > fooStr= "osplatform = 'win32', osnameversid = 8" > ormHostList = query.select_by(fooStr) > > SQLError: (ProgrammingError) syntax error at or near "," at character > 346 > > 3) I have tried query objects based on objects and on mappers. While > the underlying SQL statements differ quite a bit, the SQLError is the > same. > > query = session.query(BuildHostORM) > --same result-- > query = session.query(BuildHostORM_Mapper) > > Am I missing something really basic here? > > Thanks, > Rick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy -~----------~----~----~----~------~----~------~--~---
