Re: [cx-oracle-users] New features?
Brought to you by:
atuining
|
From: Anthony T. <ant...@gm...> - 2016-03-06 02:23:51
|
Hi Walter,
Apologies for the lengthy delay in responding to you!
The reason for the failure was that integer was not supported (it is now,
though). If you had used number or varchar2 instead all would have worked
as expected!
I also added support for the following, as suggested (thanks for the
suggestion!)
typeObj = connection.gettype("INTEGERS")
obj = typeObj.newobject([1, 2, 3, 4])
obj2 = typeObj([1, 2, 3, 4])
Let me know if you have any other difficulties or suggestions! Thanks.
Anthony
On Wed, Feb 24, 2016 at 7:07 AM, Walter Dörwald <wa...@li...>
wrote:
> On 24 Feb 2016, at 0:30, Anthony Tuininga wrote:
>
> > On Thu, Jan 28, 2016 at 2:52 AM, Walter Dörwald
> > <wa...@li...>
> > wrote:
> >
> >> On 27 Jan 2016, at 17:21, Anthony Tuininga wrote:
> >>
> >>> All,
> >>>
> >>> I have recently been able to spend a bit more time on cx_Oracle and
> >>> would
> >>> like your feedback on what features would be of the greatest benefit
> >>> to
> >>> you. Besides the ones that are in 5.2.1, the following features have
> >>> been
> >>> committed:
> >>>
> >>> Added support for pickling/unpickling error objects
> >>> Added support for getting implicit results (Oracle Database 12.1)
> >>> Added support for Transaction Guard (Oracle Database 12.1)
> >>> Added support for setting max lifetime session of pool (Oracle
> >>> Database
> >>> 12.1)
> >>>
> >>> Any and all feedback appreciated.
> >>>
> >>> Anthony
> >>
> >> We have many procedures which have a parameter with type INTEGERS,
> >> which
> >> is defined as:
> >>
> >> create or replace type integers as table of integer;
> >>
> >> I'd like to by able to such a procedure through cx_Oracle.
> >>
> >
> > This can now be done with the code in the source repository today.
> >
> > typeObj = connection.gettype("integers")
> > obj = typeObj.newobject()
> > obj.extend([1, 2, 3, 4])
> > cursor = connection.cursor()
> > cursor.callproc("someprocedure", (obj,))
>
> It doesn't seem to work for me. I get the following:
>
> $ python
> Python 3.5.1 (default, Jan 22 2016, 11:57:23)
> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >> import cx_Oracle
> >> db = cx_Oracle.connect("user/pwd@db")
> >> integers = db.gettype("INTEGERS")
> >> i = integers.newobject()
> >> i.extend([1,2,3,4])
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> cx_Oracle.NotSupportedError: Object_ConvertFromPython(): unhandled data
> type 3
> >> ^D
>
> integers is defined as:
>
> create or replace type INTEGERS as table of integer;
>
> I installed cx_Oracle via
>
> $ hg clone https://bitbucket.org/anthony_tuininga/cx_oracle
> $ cd cx_oracle
> $ pip install .
>
> BTW, it would be great if the type object could be called (just like a
> Python class) to create an instance, i.e. use:
>
> i = integers([1, 2, 3, 4])
>
> instead of
>
> i = integers.newobject()
> i.extend([1,2,3,4])
>
> Servus,
> Walter
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|