[sqlalchemy] is there a problem in $ and % in a query using engine.execute?

2011-11-21 Thread Krishnakant Mane

Hello all.
I am trying to write some code which after creating tables and related 
views trys to create the stored procedures (plpgsql).

code goes some thing like this
engine.execute(create or replace function addRecord(f1 text, f2 
t1.fieldname%type ) returns bit as $$

...
begin
...
end;
$$ language plpgsql)
When this gets executed I get the error that indicates dict object is 
not indexable.

Is this some thing to do wiht the use of % or $ sign in the query?
Note that although I wrote the code on more than one line, in my code 
its a single line statement.
All my views get created with same syntax of engine.execute() but not 
stored procedure creation code.

Any suggestion?
Happy hacking.
Krishnakant.

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



Re: [sqlalchemy] is there a problem in $ and % in a query using engine.execute?

2011-11-21 Thread Michael Bayer
try escaping the % sign as in %%.  this is psycopg2's behavior.


On Nov 21, 2011, at 1:27 PM, Krishnakant Mane wrote:

 Hello all.
 I am trying to write some code which after creating tables and related views 
 trys to create the stored procedures (plpgsql).
 code goes some thing like this
 engine.execute(create or replace function addRecord(f1 text, f2 
 t1.fieldname%type ) returns bit as $$
 ...
 begin
 ...
 end;
 $$ language plpgsql)
 When this gets executed I get the error that indicates dict object is not 
 indexable.
 Is this some thing to do wiht the use of % or $ sign in the query?
 Note that although I wrote the code on more than one line, in my code its a 
 single line statement.
 All my views get created with same syntax of engine.execute() but not stored 
 procedure creation code.
 Any suggestion?
 Happy hacking.
 Krishnakant.
 
 -- 
 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.
 

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