you should access column names via lower case

i.e.

columns = 'projectid', 'program', 'progmanger']

On 10 Jun, 03:39, Aref <arefnamm...@gmail.com> wrote:
> Hello All,
>
> I just began learning sqlalchemy and am not quite used to it yet so
> please excuse my ignorance and which might be a trivial question to
> some of you.
> I am writing a database module and need to load a table and possibly
> modify a record in the table. I can get the connection established and
> everything works fine. The problem I am running into is that I do not
> necessarily know the column name before hand to code it in the update
> method. I want to be able to find out to send a generic column name
> which will be updated (gets the column name dynamically).
>
> I tried the following:
>
> columns=['ProjectID', 'Program', 'progmanger']
> test = str('table.c.'+columns[1])
> update = table.update(test=='project-name', values = {test:'program'})
> print update
> update.execute()
>
> I get a error when I try to run it. It does not recognize the column
> for some reason even though if I print test everything seems to be OK.
> I get 'project.c.Program'
>
> Is there something I am missing here? How can I send the project and
> column name to the update method dynamically?
>
> Thank you so much in advance for any help or insight you could provide.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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