[Spacewalk-devel] Anyone Have PostgreSQL + python-pgsql experience?

Pradeep Kilambi pkilambi at redhat.com
Wed Jan 28 14:27:25 EST 2009


Devan Goodwin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Looking for anyone who has experience with these particularly in the
> realm of calling procedures, would love to bounce a few questions off
> you.
>
> It's looking like the Python DBAPI
> (http://www.python.org/dev/peps/pep-0249/) method of calling stored
> procedures (Cursor.callproc()) is not implemented for PostgreSQL. It
> looks like this is because PostgreSQL does procedures quite
> differently. 
>
> All the examples I've seen so far of using stored procedures has them
> embedded within regular queries like: 
>
> spacewalk=# select return_int(5) as qty;
>  qty 
> - -----
>    5
> (1 row)
>
> If I'm on the right track it might be possible to hack something up in
> our rhnSQL code where if you tried to call a procedure, the same way as
> we do for Oracle, it would translate it into a "SELECT blah(arg1, arg2)
> as blah" statement behind the scenes but will see how it goes.
> Otherwise we've got a problem with the backend code where we'll need to
> fork calls to procedures, though fortunately there aren't a huge number.
>
> Have to make sure I'm on the right track first.
>   

Yep, this probably would be the appropriate solution without breaking 
the oracle compatibility.
We should be able to add some overriding methods that could translate 
the sql statements
to be be pgsql centric. I agree that Its gonna be a pain if we fork each 
call.

I vote for a more generic approach as you outlined above.

- Prad


> Thanks,
>
> Devan
>
> - -- 
>   Devan Goodwin <dgoodwin at redhat.com>
>   Software Engineer     Spacewalk / RHN Satellite
>   Halifax, Canada       650.567.9039x79267
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
>
> iEYEARECAAYFAkmAgf0ACgkQAyHWaPV9my7HNgCfeMz0Cm672BodMLc3S9+b5r5A
> gLsAoOpv8xDf0PWbV8XPzZrfEch5iJjn
> =4ZG7
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel
>   


-- 
--
Pradeep Kilambi
RHN Satellite Engineering
pkilambi at redhat.com
Phone: +1 919 754 4285
RHCE # 805008680430554





More information about the Spacewalk-devel mailing list