Howto explicit cast types for PG-functions?
Martin Lesser <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
what is the best way to cast PG-datatypes from the view of my python
code so a function written in i.e. plpgsql does not claim about wrong
datatypes?
Background:
When using functions defined in the PG-backend by an execute psycopg
does not know which type of data the PG-function expects and often casts
the type incorrect so I get errors. So I would like to cast the type in
my python-code.
E.g. an error occurs when I use
cursor.execute('SELECT f_dosomething(%(var)s)', {'var':2})
and the plpgsql-function in the backend is defined as
CREATE FUNCTION f_dosomething(myvar float8 ...)
Due to the spare documentation of psycopg I did not find an appropriate
solution.
TIA, Martin