In response to myself ... I discovered that it was only when I was
specifying the function clauses as bind params in the conn.execute()
method that it was failing.  The code I presented should actually be
working correctly.

To be explicit, this seems to be working:

mytable.update(mytable.c.id==idvar, {'geocolumn':
func.GeomFromText(wkt, 4326)})

while this does not:

up = mytable.update(mytable.c.id==idvar)
conn.execute(up, {'geocolumn': func.GeomFromText(wkt, 4326)})

It wasn't obvious to me that these were not equivalent.

Sorry for the confusion!

Hans

On Sep 19, 12:52 pm, Hans Lellelid <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using SA 0.4.6 and I'm having trouble using the result of a
> database function / stored procedure in an UPDATE statement (being
> constructed with SQL expression lang).   This happens to be for using
> PostGIS columns; however, that is not relevant to the problem here.  I
> have tried doing some searching on this in the manual and in user
> group, but have not found an answer.
>
> A simplified version of my python code looks like this:
>
> mytable.update(mytable.c.id==idvar, {'geocolumn':
> func.GeomFromText(wkt, 4326)})
>
> The function is being quoted and some other weird stuff is happening,
> such that I have result SQL that looks like:
>
> UPDATE mytable SET geocolumn =
> E'GeomFromText(''GeomFromText(:GeomFromText_1, :GeomFromText_2)'',
> 4326)' WHERE id = 1
>
> So, without having looked into this more deeply (within SA), it would
> appear that I need to tell SA to treat my parameters to the func as
> literals (?) and somehow tell it to not escape the function itself
> (?).,  Is there a better / correct way to do this?  I'd be happy to
> write up some instructions for the "Functions" section of the manual
> if there is a solution or best-practice for this (will need some
> guidance on how to submit that documentation).
>
> Thanks in advance!
>
> Hans
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to