Resolved by moving the method into the schema procedure file.

On Apr 28, 10:21 am, Paul Hemans <p_hem...@hotmail.com> wrote:
> Hi I am new to Python. I need to produce a simple query on the key
> field.
> exists = self.session.query(BILLS).filter(ID=="1")
>
> However, the process is running generically. That is the declarative
> table definitions are in the file schema.py and the table, field and
> value are determined at runtime. So what I have is the following ( I
> have omitted a bit of code for clarity) :
>
> class myClass():
>     def import_data
>         import schema
>         # self.tableName defined elsewhere
>         TI = eval("schema."+self.tableName+"()")
>         exists = None
>         for node in tupleNode.childNodes:
>             for dataNode in node.childNodes:
>                     cValue = dataNode.data
>                     if node.tagName == self.keyField:
>                          #### Prob.
>                         #  self.keyField is determined elsewhere
>                         exists = self.session.query(TI).filter(getattr
> (TI,self.keyField)==cValue)
>
> I get to the query and get the following message:
> Invalid column expression '<schema.BILLS object at 0x29DB7330>'
> Any help would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to