tml wrote:
> 
> also to clarify, the text actually has :table_name used in many other
> places:
> 
> t = metadata.engine.text("LOCK TABLE :table_name WRITE; "
>                            "UPDATE :table_name SET rgt=rgt + 
> 2 WHERE rgt > :insert_node_val and parent_id = :parent_id;"
>                            "UPDATE :table_name SET lft=lft + 
> 2 WHERE lft > :insert_node_val and parent_id = :parent_id;"
>                ......
> 
> so if i had it as %s, i would have to repeat the same name 
> multiple times in % (name, name, name). I'm ok with this, 
> just curious if there is a better way.
> 

I don't think bind parameters can be used for table names, so you are
stuck with python format strings, but you can use a dictionary instead
of a tuple when formatting strings. Instead of using %s, you use
%(name)s, and instead of the tuple (name, name, name) you pass a single
dictionary {'name': <your_table_name>}

http://docs.python.org/lib/typesseq-strings.html

Hope that helps,

Simon

--~--~---------~--~----~------------~-------~--~----~
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