Issue 10 in orapig: Vectorized Python Method for Stored Procedure with no arguments

0 views
Skip to first unread message

codesite...@google.com

unread,
Jun 5, 2008, 9:30:01 PM6/5/08
to orapi...@googlegroups.com
Issue 10: Vectorized Python Method for Stored Procedure with no arguments
http://code.google.com/p/orapig/issues/detail?id=10

New issue report by MarkRoddy:
You need to pass a nested list of empty lists into the vectorized python
method that wraps a stored procedure that does not have any arguments:
package.p_noparms_V([[],[],[]])

This seems a little counter-intuitive. What about passing in an integer
for the number of times the procedure should be called, and then
generating the required data structure that needs to be passed to
cursor.executemany()? The outputted code would change from:
arguments = []
for i in range(len(parmlist)):
dict = {}
arguments.append(dict)
result = self.curs.executemany(
"begin ALLTYPES.P_NOPARMS(); end;", arguments)

to:
arguments=[{}]*call_count;
result = self.curs.executemany(
"begin ALLTYPES.P_NOPARMS(); end;", arguments)

Though I am a little hesitant about this solution as it changes the call
signature for a vectorized function which is consistant in all other cases.


Issue attributes:
Status: Accepted
Owner: MarkRoddy
Labels: Type-Enhancement Priority-Medium

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Mark Harrison

unread,
Jun 10, 2008, 12:58:11 AM6/10/08
to codesite...@google.com, orapi...@googlegroups.com
codesite...@google.com wrote:
> Issue 10: Vectorized Python Method for Stored Procedure with no arguments
> http://code.google.com/p/orapig/issues/detail?id=10
>
> New issue report by MarkRoddy:
> You need to pass a nested list of empty lists into the vectorized python
> method that wraps a stored procedure that does not have any arguments:
> package.p_noparms_V([[],[],[]])
>
> This seems a little counter-intuitive. What about passing in an integer
> for the number of times the procedure should be called, and then
> generating the required data structure that needs to be passed to
> cursor.executemany()? The outputted code would change from:
> arguments = []
> for i in range(len(parmlist)):
> dict = {}
> arguments.append(dict)
> result = self.curs.executemany(
> "begin ALLTYPES.P_NOPARMS(); end;", arguments)
>
> to:
> arguments=[{}]*call_count;
> result = self.curs.executemany(
> "begin ALLTYPES.P_NOPARMS(); end;", arguments)
>
> Though I am a little hesitant about this solution as it changes the call
> signature for a vectorized function which is consistant in all other cases.

Yes, what you say sounds reasonable. This case hadn't occurred to me.
Perhaps if we allow either the list or the count, so somebody who is
mechanically generating calls won't have to special-case having no parms?
Anybody else have an opinion?

Mark Roddy

unread,
Jun 10, 2008, 10:41:40 AM6/10/08
to orapig-dev
Allowing both methods hadn't occured to me. How about something like this:

if hassattr(args,'__len__'):
call_count=len(args)
else:
call_count=args

Then anything generated with a length property (tuple, set, etc.) or a
numeric value can be passed.


-Mark

Reply all
Reply to author
Forward
0 new messages