you probably want to use bind parameters:

metadata.engine.execute(text("select * from test where url=:url"),  
url="http://bubu.com/%_20";)


On Jul 19, 2006, at 12:19 PM, Gerhard Wohlgenannt wrote:

>
> hey everyone,
>
>
>      I ran into a "problem" (at least for me) with using sqlalchemy.
>      The query:
>      query = 'SELECT * FROM test WHERE url='http://bubu.com/%_20'
>      metadata.engine.execute(query)
>
>     raises an exception:
>         File "build/bdist.linux-i686/egg/sqlalchemy/engine/ 
> base.py", line
> 459,
>      in execute
>         File "build/bdist.linux-i686/egg/sqlalchemy/engine/ 
> base.py", line
> 240,
>      in execute
>         File "build/bdist.linux-i686/egg/sqlalchemy/engine/ 
> base.py", line
> 244,
>      in execute_text
>         File "build/bdist.linux-i686/egg/sqlalchemy/engine/ 
> base.py", line
> 315,
>      in _execute_raw
>         File "build/bdist.linux-i686/egg/sqlalchemy/engine/ 
> base.py", line
> 334,
>      in _execute
>      sqlalchemy.exceptions.SQLError: (TypeError) unindexable object  
> "SELECT
>      * FROM test WHERE url='http://bubu.com/%_20'" {}
>
> I could unescape the urls before writing them to postgres (maybe using
> MxURL ??), but is there another more obvious way to save (or query)
> url-escaped strings into the database???
>
> I would be glad to get a reply!!
>
>      cheers
>      gerhard
>
>
>
>
> ---------------------------------------------------------------------- 
> -------
>      Mag. Gerhard Wohlgenannt                 | [EMAIL PROTECTED]
> ---------------------------------------------------------------------- 
> -------
>
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys -- and earn  
> cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to