Skip to content

Mappings for easy access to (database) stored procedures in Python

Notifications You must be signed in to change notification settings

tehmaze-labs/dbproc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBProc

Mappings for easy access to (database) stored procedures in Python.

Database support

Currently the following database types are supported:

Example

Firstly, we can declare a PL/pgSQL stored procedure as follows:

   CREATE OR REPLACE FUNCTION test_dbproc_add(a INTEGER, b INTEGER)
       RETURNS INTEGER AS $$
   BEGIN
       RETURN $1 + $2;
   END;
   $$ LANGUAGE 'plpgsql';

Now, using wrap, we can access this stored procedure in Python like:

   >>> import psycopg2
   >>> from dbproc import Wrap
   >>> conn = psycopg2.connect('dbname=test')
   >>> proc = Wrap(conn, prefix='test_dbproc_')
   >>> print proc.add(23, 42)
   65

Bugs/Features

You can issue a ticket in GitHub: https://github.com/tehmaze/dbproc

About

Mappings for easy access to (database) stored procedures in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages