cx-oracle-users Mailing List for cx_Oracle (Page 4)
Brought to you by:
atuining
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(9) |
Sep
(8) |
Oct
(12) |
Nov
(4) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(15) |
Feb
(12) |
Mar
(11) |
Apr
(5) |
May
(7) |
Jun
(8) |
Jul
(12) |
Aug
(2) |
Sep
(14) |
Oct
(17) |
Nov
(20) |
Dec
(3) |
2005 |
Jan
(16) |
Feb
(9) |
Mar
(22) |
Apr
(21) |
May
(73) |
Jun
(16) |
Jul
(15) |
Aug
(10) |
Sep
(32) |
Oct
(35) |
Nov
(22) |
Dec
(13) |
2006 |
Jan
(42) |
Feb
(36) |
Mar
(13) |
Apr
(18) |
May
(8) |
Jun
(17) |
Jul
(24) |
Aug
(30) |
Sep
(35) |
Oct
(33) |
Nov
(33) |
Dec
(11) |
2007 |
Jan
(35) |
Feb
(31) |
Mar
(35) |
Apr
(64) |
May
(38) |
Jun
(12) |
Jul
(18) |
Aug
(34) |
Sep
(75) |
Oct
(29) |
Nov
(51) |
Dec
(11) |
2008 |
Jan
(27) |
Feb
(46) |
Mar
(48) |
Apr
(36) |
May
(59) |
Jun
(42) |
Jul
(25) |
Aug
(34) |
Sep
(57) |
Oct
(97) |
Nov
(59) |
Dec
(57) |
2009 |
Jan
(48) |
Feb
(48) |
Mar
(45) |
Apr
(24) |
May
(46) |
Jun
(52) |
Jul
(52) |
Aug
(37) |
Sep
(27) |
Oct
(40) |
Nov
(37) |
Dec
(13) |
2010 |
Jan
(16) |
Feb
(9) |
Mar
(24) |
Apr
(6) |
May
(27) |
Jun
(28) |
Jul
(60) |
Aug
(16) |
Sep
(33) |
Oct
(20) |
Nov
(39) |
Dec
(30) |
2011 |
Jan
(23) |
Feb
(43) |
Mar
(16) |
Apr
(29) |
May
(23) |
Jun
(16) |
Jul
(10) |
Aug
(8) |
Sep
(18) |
Oct
(42) |
Nov
(26) |
Dec
(20) |
2012 |
Jan
(17) |
Feb
(27) |
Mar
|
Apr
(20) |
May
(18) |
Jun
(7) |
Jul
(24) |
Aug
(21) |
Sep
(23) |
Oct
(18) |
Nov
(12) |
Dec
(5) |
2013 |
Jan
(14) |
Feb
(10) |
Mar
(20) |
Apr
(65) |
May
(3) |
Jun
(8) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(3) |
Nov
(28) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(9) |
Mar
(4) |
Apr
(7) |
May
(20) |
Jun
(2) |
Jul
(20) |
Aug
(7) |
Sep
(11) |
Oct
(8) |
Nov
(6) |
Dec
(12) |
2015 |
Jan
(16) |
Feb
(10) |
Mar
(14) |
Apr
(8) |
May
|
Jun
(8) |
Jul
(15) |
Aug
(7) |
Sep
(1) |
Oct
(33) |
Nov
(8) |
Dec
(5) |
2016 |
Jan
(18) |
Feb
(12) |
Mar
(6) |
Apr
(14) |
May
(5) |
Jun
(3) |
Jul
|
Aug
(21) |
Sep
|
Oct
(15) |
Nov
(8) |
Dec
|
2017 |
Jan
|
Feb
(14) |
Mar
(21) |
Apr
(9) |
May
(6) |
Jun
(11) |
Jul
(23) |
Aug
(6) |
Sep
(5) |
Oct
(7) |
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(16) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
2021 |
Jan
|
Feb
(5) |
Mar
|
Apr
(7) |
May
(6) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Anthony T. <ant...@gm...> - 2017-10-13 17:20:56
|
Hi, For this sort of thing I would definitely suggest subclassing from cx_Oracle.Connection and cx_Oracle.Cursor. Something like this: class MyConnection(cx_Oracle.Connection): DEFAULT_DB = '127.0.0.1/TT_1122:timesten:direct' DEFAULT_DB_USER = "username" DEFAULT_DB_USER_PASSWD = "password" def __init__(self, db = None, user = None, passw = None): super(MyConnection, self).__init__(user or self.DEFAULT_DB_USER, passw or self.DEFAULT_DB_USER_PASSWD, db or self.DEFAULT_DB) self.outputtypehandler = self.OutputTypeHandler def OutputTypeHandler(cursor, name, defaultType, size, precision, scale): if defaultType == cx_Oralce.NUMBER: return cursor.var(decimal.Decimal, arraysize=cursor.arraysize) def cursor(self): return MyCursor(self) class MyCursor(cx_Oracle.Cursor): pass A few comments: (1) I've simplified the output type handler since cx_Oracle knows how to convert directly to decimal.Decimal (2) Unless you want to override cursor.execute() or add additional functions yourself, there probably isn't any need to subclass the cursor I'm not sure what you mean by your last sentences. If you can explain further I can try to help. On Mon, Sep 25, 2017 at 10:10 PM, Andrew Zyman <fo...@gm...> wrote: > Hello, > i'm trying to use the module within a designated "Database" class and > having all sorts of funny situations. > I'd appreciate some guidance on how to architecture the interaction in a > better way. > > Task: > I'd like to separate all database related operations into one class ( > let's call it DB). > > for example: > > import cx_Oracle > import decimal > > class DB(): > DEFAULT_DB = '127.0.0.1/TT_1122:timesten:direct' > DEFAULT_DB_USER = "username" > DEFAULT_DB_USER_PASSWD = "password" > > def __init__(self, db = None, user = None, passw = None): > if db is None: > db = self.DEFAULT_DB > if user is None: > user = self.DEFAULT_DB_USER > if passw is None: > passw = self.DEFAULT_DB_USER_PASSWD > > self.connection = cx_Oracle.Connection(user + "/" + passw + "@" + self.DEFAULT_DB) > self.connection.outputtypehandler = self.OutputTypeHandler > > def OutputTypeHandler(cursor, name, defaultType, size, precision, scale): > if defaultType == cx_Oralce.NUMBER: > return cursor.var(str, size=200, arraysize=Cursor.arraysize, > outconverter=decimal.Decimal) > > def close(self, commit=True): > """Close connection""" > if commit: > self.connection.commit() > self.connection.close() > > def checkData(self, minutes): > > cursor = self.connection.cursor() > cursor.execute("select sum(reqid) from movaver") > rows = cursor.fetchone() > cursor.close() > if rows is None: > raise Exception("No rows returned during checkData({})".format(minutes)) > return rows[0] > > > There are a few issues with this approach. For instance the "var" and > "arraysize" in cursor ( function OutputTypeHandler" are not been resolved > as attributes of "cursor" > > though, if i do not try to wrap this functionality in the class and just > simply import the cx_Oracle and start writing the functions - everything > gets resolved as expected. > > > My other attempt was to import Connection, Cursor etc from cx_Oracle and > define DB as a child of many parents... This is how i learned that python > doesn't support such arrangements. > > Appreciate your advice. > > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Andrew Z. <fo...@gm...> - 2017-09-26 04:23:25
|
Hello, wonder if there are any plans to make the module "compatible" with asyncio ? Thank you AZ |
From: Andrew Z. <fo...@gm...> - 2017-09-26 04:11:04
|
Hello, i'm trying to use the module within a designated "Database" class and having all sorts of funny situations. I'd appreciate some guidance on how to architecture the interaction in a better way. Task: I'd like to separate all database related operations into one class ( let's call it DB). for example: import cx_Oracle import decimal class DB(): DEFAULT_DB = '127.0.0.1/TT_1122:timesten:direct' DEFAULT_DB_USER = "username" DEFAULT_DB_USER_PASSWD = "password" def __init__(self, db = None, user = None, passw = None): if db is None: db = self.DEFAULT_DB if user is None: user = self.DEFAULT_DB_USER if passw is None: passw = self.DEFAULT_DB_USER_PASSWD self.connection = cx_Oracle.Connection(user + "/" + passw + "@" + self.DEFAULT_DB) self.connection.outputtypehandler = self.OutputTypeHandler def OutputTypeHandler(cursor, name, defaultType, size, precision, scale): if defaultType == cx_Oralce.NUMBER: return cursor.var(str, size=200, arraysize=Cursor.arraysize, outconverter=decimal.Decimal) def close(self, commit=True): """Close connection""" if commit: self.connection.commit() self.connection.close() def checkData(self, minutes): cursor = self.connection.cursor() cursor.execute("select sum(reqid) from movaver") rows = cursor.fetchone() cursor.close() if rows is None: raise Exception("No rows returned during checkData({})".format(minutes)) return rows[0] There are a few issues with this approach. For instance the "var" and "arraysize" in cursor ( function OutputTypeHandler" are not been resolved as attributes of "cursor" though, if i do not try to wrap this functionality in the class and just simply import the cx_Oracle and start writing the functions - everything gets resolved as expected. My other attempt was to import Connection, Cursor etc from cx_Oracle and define DB as a child of many parents... This is how i learned that python doesn't support such arrangements. Appreciate your advice. |
From: Anthony T. <ant...@gm...> - 2017-09-05 15:28:41
|
On Tue, Sep 5, 2017 at 8:31 AM, Walter Dörwald <wa...@li...> wrote: > On 4 Sep 2017, at 23:21, Anthony Tuininga wrote: > > On Wed, Aug 30, 2017 at 3:40 AM, Walter Dörwald <wa...@li...> >> wrote: >> >> On 30 Aug 2017, at 1:09, Anthony Tuininga wrote: >>> >>> Hi Walter, >>>> >>>> I just tried this on Linux with 12.2 Client and Database. I got these >>>> results: >>>> >>>> table 1.1217586994171143 >>>> object 0.8592920303344727 >>>> >>>> When I change the number of iterations from 1300 to 1200 I get this: >>>> >>>> table 0.996464729309082 >>>> object 0.747194766998291 >>>> >>>> So it seems consistent. Are you able to try with a different >>>> database/client scenario to see if the issues you are seeing are version >>>> specific? >>>> >>> >>> I retried on Linux with the same database: >>> >>> In [1] ▸ import cx_Oracle >>> In [2] ▸ cx_Oracle.clientversion() >>> Out[3] ▸ (11, 2, 0, 2, 0) >>> In [4] ▸ cx_Oracle.version >>> Out[4] ▸ '6.0.1' >>> In [5] ▸ db = cx_Oracle.connect("user/pwd@db") >>> In [6] ▸ db.version >>> Out[6] ▸ '11.2.0.1.0' >>> >>> With 1200 iterations I get: >>> >>> table 0.3604605197906494 >>> object 0.8905477523803711 >>> equal True >>> >>> With 1300 iterations I get: >>> >>> table 0.3804595470428467 >>> object 42.898988246917725 >>> equal True >>> >>> The strange thing is that >>> >>> c.execute("select test_events2 from dual") >>> >>> takes 0.2 seconds and >>> >>> objs = c.fetchone()[0].aslist() >>> >>> takes 0.1 seconds, but accessing the attributes takes 42 seconds. >>> >>> I also tried the script on Linux against a 12.1.0.2.0 database. The >>> output: >>> >>> table 0.5058784484863281 >>> object select 0.20530128479003906 >>> object fetch 0.10213565826416016 >>> object convert 110.43995141983032 >>> object 110.74747037887573 >>> equal True >>> >>> So maybe this problem is specific to the client version? >>> >>> Or it happens on all versions, but the threshold is higher? >>> >>> >> I just tried with 11.2 client and I get similar responses to yours. >> >> 1200: >> table 0.9072585105895996 >> object 0.710052490234375 >> >> 1300: >> table 1.0106935501098633 >> object 116.8638014793396 >> >> With 12.1 client I also get similar numbers: >> >> 1200: >> table 0.9160842895507812 >> object 0.7757439613342285 >> >> 1300: >> table 1.0204412937164307 >> object 118.60206842422485 >> >> So apparently, this was a performance issue resolved in 12.2 client. If >> you >> can upgrade, do it! >> > > I'd like to, but > > http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html > > doesn't list any 12.2 version for the Mac. > Ah yes, that is a problem. :-( Hopefully that will get resolved soon! > > Anthony >> > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Walter <wa...@li...> - 2017-09-05 14:31:43
|
On 4 Sep 2017, at 23:21, Anthony Tuininga wrote: > On Wed, Aug 30, 2017 at 3:40 AM, Walter Dörwald > <wa...@li...> > wrote: > >> On 30 Aug 2017, at 1:09, Anthony Tuininga wrote: >> >>> Hi Walter, >>> >>> I just tried this on Linux with 12.2 Client and Database. I got >>> these >>> results: >>> >>> table 1.1217586994171143 >>> object 0.8592920303344727 >>> >>> When I change the number of iterations from 1300 to 1200 I get this: >>> >>> table 0.996464729309082 >>> object 0.747194766998291 >>> >>> So it seems consistent. Are you able to try with a different >>> database/client scenario to see if the issues you are seeing are >>> version >>> specific? >> >> I retried on Linux with the same database: >> >> In [1] ▸ import cx_Oracle >> In [2] ▸ cx_Oracle.clientversion() >> Out[3] ▸ (11, 2, 0, 2, 0) >> In [4] ▸ cx_Oracle.version >> Out[4] ▸ '6.0.1' >> In [5] ▸ db = cx_Oracle.connect("user/pwd@db") >> In [6] ▸ db.version >> Out[6] ▸ '11.2.0.1.0' >> >> With 1200 iterations I get: >> >> table 0.3604605197906494 >> object 0.8905477523803711 >> equal True >> >> With 1300 iterations I get: >> >> table 0.3804595470428467 >> object 42.898988246917725 >> equal True >> >> The strange thing is that >> >> c.execute("select test_events2 from dual") >> >> takes 0.2 seconds and >> >> objs = c.fetchone()[0].aslist() >> >> takes 0.1 seconds, but accessing the attributes takes 42 seconds. >> >> I also tried the script on Linux against a 12.1.0.2.0 database. The >> output: >> >> table 0.5058784484863281 >> object select 0.20530128479003906 >> object fetch 0.10213565826416016 >> object convert 110.43995141983032 >> object 110.74747037887573 >> equal True >> >> So maybe this problem is specific to the client version? >> >> Or it happens on all versions, but the threshold is higher? >> > > I just tried with 11.2 client and I get similar responses to yours. > > 1200: > table 0.9072585105895996 > object 0.710052490234375 > > 1300: > table 1.0106935501098633 > object 116.8638014793396 > > With 12.1 client I also get similar numbers: > > 1200: > table 0.9160842895507812 > object 0.7757439613342285 > > 1300: > table 1.0204412937164307 > object 118.60206842422485 > > So apparently, this was a performance issue resolved in 12.2 client. > If you > can upgrade, do it! I'd like to, but http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html doesn't list any 12.2 version for the Mac. > Anthony Servus, Walter |
From: Anthony T. <ant...@gm...> - 2017-09-04 21:21:56
|
On Wed, Aug 30, 2017 at 3:40 AM, Walter Dörwald <wa...@li...> wrote: > On 30 Aug 2017, at 1:09, Anthony Tuininga wrote: > > > Hi Walter, > > > > I just tried this on Linux with 12.2 Client and Database. I got these > > results: > > > > table 1.1217586994171143 > > object 0.8592920303344727 > > > > When I change the number of iterations from 1300 to 1200 I get this: > > > > table 0.996464729309082 > > object 0.747194766998291 > > > > So it seems consistent. Are you able to try with a different > > database/client scenario to see if the issues you are seeing are version > > specific? > > I retried on Linux with the same database: > > In [1] ▸ import cx_Oracle > In [2] ▸ cx_Oracle.clientversion() > Out[3] ▸ (11, 2, 0, 2, 0) > In [4] ▸ cx_Oracle.version > Out[4] ▸ '6.0.1' > In [5] ▸ db = cx_Oracle.connect("user/pwd@db") > In [6] ▸ db.version > Out[6] ▸ '11.2.0.1.0' > > With 1200 iterations I get: > > table 0.3604605197906494 > object 0.8905477523803711 > equal True > > With 1300 iterations I get: > > table 0.3804595470428467 > object 42.898988246917725 > equal True > > The strange thing is that > > c.execute("select test_events2 from dual") > > takes 0.2 seconds and > > objs = c.fetchone()[0].aslist() > > takes 0.1 seconds, but accessing the attributes takes 42 seconds. > > I also tried the script on Linux against a 12.1.0.2.0 database. The output: > > table 0.5058784484863281 > object select 0.20530128479003906 > object fetch 0.10213565826416016 > object convert 110.43995141983032 > object 110.74747037887573 > equal True > > So maybe this problem is specific to the client version? > > Or it happens on all versions, but the threshold is higher? > I just tried with 11.2 client and I get similar responses to yours. 1200: table 0.9072585105895996 object 0.710052490234375 1300: table 1.0106935501098633 object 116.8638014793396 With 12.1 client I also get similar numbers: 1200: table 0.9160842895507812 object 0.7757439613342285 1300: table 1.0204412937164307 object 118.60206842422485 So apparently, this was a performance issue resolved in 12.2 client. If you can upgrade, do it! Anthony > > > Anthony > > > > On Thu, Aug 24, 2017 at 11:28 AM, Walter Dörwald <wa...@li...> > > wrote: > > > >> Hello all! > >> > >> Now that cx_Oracle supports custom Oracle object types I tried them and > >> discovered strange performance fluctuations. I defined the following > types > >> and functions in the database: > >> > >> --------------------------------------------- > >> > >> create or replace type ul4onevent as object > >> ( > >> ue_type varchar2(20), > >> ue_backref integer, > >> ue_int1 integer, > >> ue_int2 integer, > >> ue_int3 integer, > >> ue_number number, > >> ue_date date, > >> ue_str varchar2(32000) > >> ); > >> / > >> > >> create or replace type ul4onevents as table of ul4onevent; > >> / > >> > >> create or replace function test_events2 > >> return ul4onevents > >> as > >> v_events ul4onevents; > >> > >> procedure append( > >> p_ue_type varchar2, > >> p_ue_backref integer := null, > >> p_ue_int1 integer := null, > >> p_ue_int2 integer := null, > >> p_ue_int3 integer := null, > >> p_ue_number number := null, > >> p_ue_date date := null, > >> p_ue_str varchar2 := null > >> ) > >> as > >> begin > >> v_events.extend; > >> v_events(v_events.count) := ul4onevent(p_ue_type, > >> p_ue_backref, p_ue_int1, p_ue_int2, p_ue_int3, p_ue_number, p_ue_date, > >> p_ue_str); > >> end; > >> begin > >> v_events := ul4onevents(); > >> > >> append('beginlist'); > >> for i in 1 .. 1300 loop > >> append('begindict'); > >> append('str', p_ue_str=>'firstname'); > >> append('str', p_ue_str=>'Foo'); > >> append('str', p_ue_str=>'lastname'); > >> append('str', p_ue_str=>'Bar'); > >> append('str', p_ue_str=>'none'); > >> append('none'); > >> append('str', p_ue_str=>'bool'); > >> append('bool', p_ue_int1=>1); > >> append('str', p_ue_str=>'int'); > >> append('int', p_ue_int1=>42); > >> append('str', p_ue_str=>'float'); > >> append('number', p_ue_number=>42.5); > >> append('str', p_ue_str=>'date'); > >> append('date', > >> p_ue_date=>to_date('29.02.2000', 'DD.MM.YYYY')); > >> append('str', p_ue_str=>'color'); > >> append('color', p_ue_int1=>845453000); > >> append('str', p_ue_str=>'timedelta'); > >> append('timedelta', p_ue_int1=>0, > >> p_ue_int2=>42, p_ue_int3=>0); > >> append('str', p_ue_str=>'monthdelta'); > >> append('monthdelta', 17); > >> append('str', p_ue_str=>'slice'); > >> append('slice', p_ue_int1=>17, > >> p_ue_int2=>23); > >> append('enddict'); > >> end loop; > >> append('endlist'); > >> return v_events; > >> end; > >> / > >> > >> --------------------------------------------- > >> > >> I used the following script to compare the performance of > >> > >> select * from table(test_events2) > >> > >> and > >> > >> select test_events2 from dual > >> > >> --------------------------------------------- > >> > >> import time > >> import cx_Oracle > >> > >> db = cx_Oracle.connect("user/pwd@db") > >> c = db.cursor() > >> > >> t1 = time.time() > >> > >> e1 = [] > >> c.execute("select * from table(test_events2)") > >> for r in c: > >> e1.append(tuple(r)) > >> > >> t2 = time.time() > >> > >> e2 = [] > >> c.execute("select test_events2 from dual") > >> > >> objs = c.fetchone()[0].aslist() > >> > >> for obj in objs: > >> e2.append(( > >> obj.UE_TYPE, > >> obj.UE_BACKREF, > >> obj.UE_INT1, > >> obj.UE_INT2, > >> obj.UE_INT3, > >> obj.UE_NUMBER, > >> obj.UE_DATE, > >> obj.UE_STR, > >> )) > >> > >> t3 = time.time() > >> > >> print("table", t2-t1) > >> print("object", t3-t2) > >> print("equal", e1 == e2) > >> > >> --------------------------------------------- > >> > >> The output is: > >> > >> --------------------------------------------- > >> > >> table 0.4585990905761719 > >> object 106.14051795005798 > >> equal True > >> > >> --------------------------------------------- > >> > >> i.e. the object version is 230 times slower than the table version. > When I > >> change the number of iterations from 1300 to 1200 the output is: > >> > >> --------------------------------------------- > >> > >> table 0.4336049556732178 > >> object 1.2956831455230713 > >> equal True > >> > >> --------------------------------------------- > >> > >> I wonder why that happens. > >> > >> The database version is 11.2.0.1.0 and I'm using Python 3.6.2 with > >> cx_Oracle 6.0.1 on Mac OS X 10.12.6. > >> > >> Servus, > >> Walter > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Anthony T. <ant...@gm...> - 2017-08-30 19:36:32
|
What is cx_Oracle? cx_Oracle is a Python extension module that enables access to Oracle Database for Python 3.x and 2.x and conforms to the Python database API 2.0 specifications with a number of enhancements. Where do I get it? https://oracle.github.io/python-cx_Oracle The easiest method to install cx_Oracle is via pip as in python -m pip install cx_Oracle --upgrade What's new? This release addresses issues found since the previous release. The full release notes can be read here: http://cx-oracle.readthedocs.io/en/latest/releasenotes. html#version-6-0-2-august-2017 Please provide any feedback via GitHub issues (https://github.com/oracle/pyt hon-cx_Oracle/issues). |
From: Walter <wa...@li...> - 2017-08-30 09:40:47
|
On 30 Aug 2017, at 1:09, Anthony Tuininga wrote: > Hi Walter, > > I just tried this on Linux with 12.2 Client and Database. I got these > results: > > table 1.1217586994171143 > object 0.8592920303344727 > > When I change the number of iterations from 1300 to 1200 I get this: > > table 0.996464729309082 > object 0.747194766998291 > > So it seems consistent. Are you able to try with a different > database/client scenario to see if the issues you are seeing are version > specific? I retried on Linux with the same database: In [1] ▸ import cx_Oracle In [2] ▸ cx_Oracle.clientversion() Out[3] ▸ (11, 2, 0, 2, 0) In [4] ▸ cx_Oracle.version Out[4] ▸ '6.0.1' In [5] ▸ db = cx_Oracle.connect("user/pwd@db") In [6] ▸ db.version Out[6] ▸ '11.2.0.1.0' With 1200 iterations I get: table 0.3604605197906494 object 0.8905477523803711 equal True With 1300 iterations I get: table 0.3804595470428467 object 42.898988246917725 equal True The strange thing is that c.execute("select test_events2 from dual") takes 0.2 seconds and objs = c.fetchone()[0].aslist() takes 0.1 seconds, but accessing the attributes takes 42 seconds. I also tried the script on Linux against a 12.1.0.2.0 database. The output: table 0.5058784484863281 object select 0.20530128479003906 object fetch 0.10213565826416016 object convert 110.43995141983032 object 110.74747037887573 equal True So maybe this problem is specific to the client version? Or it happens on all versions, but the threshold is higher? > Anthony > > On Thu, Aug 24, 2017 at 11:28 AM, Walter Dörwald <wa...@li...> > wrote: > >> Hello all! >> >> Now that cx_Oracle supports custom Oracle object types I tried them and >> discovered strange performance fluctuations. I defined the following types >> and functions in the database: >> >> --------------------------------------------- >> >> create or replace type ul4onevent as object >> ( >> ue_type varchar2(20), >> ue_backref integer, >> ue_int1 integer, >> ue_int2 integer, >> ue_int3 integer, >> ue_number number, >> ue_date date, >> ue_str varchar2(32000) >> ); >> / >> >> create or replace type ul4onevents as table of ul4onevent; >> / >> >> create or replace function test_events2 >> return ul4onevents >> as >> v_events ul4onevents; >> >> procedure append( >> p_ue_type varchar2, >> p_ue_backref integer := null, >> p_ue_int1 integer := null, >> p_ue_int2 integer := null, >> p_ue_int3 integer := null, >> p_ue_number number := null, >> p_ue_date date := null, >> p_ue_str varchar2 := null >> ) >> as >> begin >> v_events.extend; >> v_events(v_events.count) := ul4onevent(p_ue_type, >> p_ue_backref, p_ue_int1, p_ue_int2, p_ue_int3, p_ue_number, p_ue_date, >> p_ue_str); >> end; >> begin >> v_events := ul4onevents(); >> >> append('beginlist'); >> for i in 1 .. 1300 loop >> append('begindict'); >> append('str', p_ue_str=>'firstname'); >> append('str', p_ue_str=>'Foo'); >> append('str', p_ue_str=>'lastname'); >> append('str', p_ue_str=>'Bar'); >> append('str', p_ue_str=>'none'); >> append('none'); >> append('str', p_ue_str=>'bool'); >> append('bool', p_ue_int1=>1); >> append('str', p_ue_str=>'int'); >> append('int', p_ue_int1=>42); >> append('str', p_ue_str=>'float'); >> append('number', p_ue_number=>42.5); >> append('str', p_ue_str=>'date'); >> append('date', >> p_ue_date=>to_date('29.02.2000', 'DD.MM.YYYY')); >> append('str', p_ue_str=>'color'); >> append('color', p_ue_int1=>845453000); >> append('str', p_ue_str=>'timedelta'); >> append('timedelta', p_ue_int1=>0, >> p_ue_int2=>42, p_ue_int3=>0); >> append('str', p_ue_str=>'monthdelta'); >> append('monthdelta', 17); >> append('str', p_ue_str=>'slice'); >> append('slice', p_ue_int1=>17, >> p_ue_int2=>23); >> append('enddict'); >> end loop; >> append('endlist'); >> return v_events; >> end; >> / >> >> --------------------------------------------- >> >> I used the following script to compare the performance of >> >> select * from table(test_events2) >> >> and >> >> select test_events2 from dual >> >> --------------------------------------------- >> >> import time >> import cx_Oracle >> >> db = cx_Oracle.connect("user/pwd@db") >> c = db.cursor() >> >> t1 = time.time() >> >> e1 = [] >> c.execute("select * from table(test_events2)") >> for r in c: >> e1.append(tuple(r)) >> >> t2 = time.time() >> >> e2 = [] >> c.execute("select test_events2 from dual") >> >> objs = c.fetchone()[0].aslist() >> >> for obj in objs: >> e2.append(( >> obj.UE_TYPE, >> obj.UE_BACKREF, >> obj.UE_INT1, >> obj.UE_INT2, >> obj.UE_INT3, >> obj.UE_NUMBER, >> obj.UE_DATE, >> obj.UE_STR, >> )) >> >> t3 = time.time() >> >> print("table", t2-t1) >> print("object", t3-t2) >> print("equal", e1 == e2) >> >> --------------------------------------------- >> >> The output is: >> >> --------------------------------------------- >> >> table 0.4585990905761719 >> object 106.14051795005798 >> equal True >> >> --------------------------------------------- >> >> i.e. the object version is 230 times slower than the table version. When I >> change the number of iterations from 1300 to 1200 the output is: >> >> --------------------------------------------- >> >> table 0.4336049556732178 >> object 1.2956831455230713 >> equal True >> >> --------------------------------------------- >> >> I wonder why that happens. >> >> The database version is 11.2.0.1.0 and I'm using Python 3.6.2 with >> cx_Oracle 6.0.1 on Mac OS X 10.12.6. >> >> Servus, >> Walter Servus, Walter |
From: Anthony T. <ant...@gm...> - 2017-08-29 23:09:11
|
Hi Walter, I just tried this on Linux with 12.2 Client and Database. I got these results: table 1.1217586994171143 object 0.8592920303344727 When I change the number of iterations from 1300 to 1200 I get this: table 0.996464729309082 object 0.747194766998291 So it seems consistent. Are you able to try with a different database/client scenario to see if the issues you are seeing are version specific? Anthony On Thu, Aug 24, 2017 at 11:28 AM, Walter Dörwald <wa...@li...> wrote: > Hello all! > > Now that cx_Oracle supports custom Oracle object types I tried them and > discovered strange performance fluctuations. I defined the following types > and functions in the database: > > --------------------------------------------- > > create or replace type ul4onevent as object > ( > ue_type varchar2(20), > ue_backref integer, > ue_int1 integer, > ue_int2 integer, > ue_int3 integer, > ue_number number, > ue_date date, > ue_str varchar2(32000) > ); > / > > create or replace type ul4onevents as table of ul4onevent; > / > > create or replace function test_events2 > return ul4onevents > as > v_events ul4onevents; > > procedure append( > p_ue_type varchar2, > p_ue_backref integer := null, > p_ue_int1 integer := null, > p_ue_int2 integer := null, > p_ue_int3 integer := null, > p_ue_number number := null, > p_ue_date date := null, > p_ue_str varchar2 := null > ) > as > begin > v_events.extend; > v_events(v_events.count) := ul4onevent(p_ue_type, > p_ue_backref, p_ue_int1, p_ue_int2, p_ue_int3, p_ue_number, p_ue_date, > p_ue_str); > end; > begin > v_events := ul4onevents(); > > append('beginlist'); > for i in 1 .. 1300 loop > append('begindict'); > append('str', p_ue_str=>'firstname'); > append('str', p_ue_str=>'Foo'); > append('str', p_ue_str=>'lastname'); > append('str', p_ue_str=>'Bar'); > append('str', p_ue_str=>'none'); > append('none'); > append('str', p_ue_str=>'bool'); > append('bool', p_ue_int1=>1); > append('str', p_ue_str=>'int'); > append('int', p_ue_int1=>42); > append('str', p_ue_str=>'float'); > append('number', p_ue_number=>42.5); > append('str', p_ue_str=>'date'); > append('date', > p_ue_date=>to_date('29.02.2000', 'DD.MM.YYYY')); > append('str', p_ue_str=>'color'); > append('color', p_ue_int1=>845453000); > append('str', p_ue_str=>'timedelta'); > append('timedelta', p_ue_int1=>0, > p_ue_int2=>42, p_ue_int3=>0); > append('str', p_ue_str=>'monthdelta'); > append('monthdelta', 17); > append('str', p_ue_str=>'slice'); > append('slice', p_ue_int1=>17, > p_ue_int2=>23); > append('enddict'); > end loop; > append('endlist'); > return v_events; > end; > / > > --------------------------------------------- > > I used the following script to compare the performance of > > select * from table(test_events2) > > and > > select test_events2 from dual > > --------------------------------------------- > > import time > import cx_Oracle > > db = cx_Oracle.connect("user/pwd@db") > c = db.cursor() > > t1 = time.time() > > e1 = [] > c.execute("select * from table(test_events2)") > for r in c: > e1.append(tuple(r)) > > t2 = time.time() > > e2 = [] > c.execute("select test_events2 from dual") > > objs = c.fetchone()[0].aslist() > > for obj in objs: > e2.append(( > obj.UE_TYPE, > obj.UE_BACKREF, > obj.UE_INT1, > obj.UE_INT2, > obj.UE_INT3, > obj.UE_NUMBER, > obj.UE_DATE, > obj.UE_STR, > )) > > t3 = time.time() > > print("table", t2-t1) > print("object", t3-t2) > print("equal", e1 == e2) > > --------------------------------------------- > > The output is: > > --------------------------------------------- > > table 0.4585990905761719 > object 106.14051795005798 > equal True > > --------------------------------------------- > > i.e. the object version is 230 times slower than the table version. When I > change the number of iterations from 1300 to 1200 the output is: > > --------------------------------------------- > > table 0.4336049556732178 > object 1.2956831455230713 > equal True > > --------------------------------------------- > > I wonder why that happens. > > The database version is 11.2.0.1.0 and I'm using Python 3.6.2 with > cx_Oracle 6.0.1 on Mac OS X 10.12.6. > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Walter <wa...@li...> - 2017-08-24 17:57:21
|
Hello all! Now that cx_Oracle supports custom Oracle object types I tried them and discovered strange performance fluctuations. I defined the following types and functions in the database: --------------------------------------------- create or replace type ul4onevent as object ( ue_type varchar2(20), ue_backref integer, ue_int1 integer, ue_int2 integer, ue_int3 integer, ue_number number, ue_date date, ue_str varchar2(32000) ); / create or replace type ul4onevents as table of ul4onevent; / create or replace function test_events2 return ul4onevents as v_events ul4onevents; procedure append( p_ue_type varchar2, p_ue_backref integer := null, p_ue_int1 integer := null, p_ue_int2 integer := null, p_ue_int3 integer := null, p_ue_number number := null, p_ue_date date := null, p_ue_str varchar2 := null ) as begin v_events.extend; v_events(v_events.count) := ul4onevent(p_ue_type, p_ue_backref, p_ue_int1, p_ue_int2, p_ue_int3, p_ue_number, p_ue_date, p_ue_str); end; begin v_events := ul4onevents(); append('beginlist'); for i in 1 .. 1300 loop append('begindict'); append('str', p_ue_str=>'firstname'); append('str', p_ue_str=>'Foo'); append('str', p_ue_str=>'lastname'); append('str', p_ue_str=>'Bar'); append('str', p_ue_str=>'none'); append('none'); append('str', p_ue_str=>'bool'); append('bool', p_ue_int1=>1); append('str', p_ue_str=>'int'); append('int', p_ue_int1=>42); append('str', p_ue_str=>'float'); append('number', p_ue_number=>42.5); append('str', p_ue_str=>'date'); append('date', p_ue_date=>to_date('29.02.2000', 'DD.MM.YYYY')); append('str', p_ue_str=>'color'); append('color', p_ue_int1=>845453000); append('str', p_ue_str=>'timedelta'); append('timedelta', p_ue_int1=>0, p_ue_int2=>42, p_ue_int3=>0); append('str', p_ue_str=>'monthdelta'); append('monthdelta', 17); append('str', p_ue_str=>'slice'); append('slice', p_ue_int1=>17, p_ue_int2=>23); append('enddict'); end loop; append('endlist'); return v_events; end; / --------------------------------------------- I used the following script to compare the performance of select * from table(test_events2) and select test_events2 from dual --------------------------------------------- import time import cx_Oracle db = cx_Oracle.connect("user/pwd@db") c = db.cursor() t1 = time.time() e1 = [] c.execute("select * from table(test_events2)") for r in c: e1.append(tuple(r)) t2 = time.time() e2 = [] c.execute("select test_events2 from dual") objs = c.fetchone()[0].aslist() for obj in objs: e2.append(( obj.UE_TYPE, obj.UE_BACKREF, obj.UE_INT1, obj.UE_INT2, obj.UE_INT3, obj.UE_NUMBER, obj.UE_DATE, obj.UE_STR, )) t3 = time.time() print("table", t2-t1) print("object", t3-t2) print("equal", e1 == e2) --------------------------------------------- The output is: --------------------------------------------- table 0.4585990905761719 object 106.14051795005798 equal True --------------------------------------------- i.e. the object version is 230 times slower than the table version. When I change the number of iterations from 1300 to 1200 the output is: --------------------------------------------- table 0.4336049556732178 object 1.2956831455230713 equal True --------------------------------------------- I wonder why that happens. The database version is 11.2.0.1.0 and I'm using Python 3.6.2 with cx_Oracle 6.0.1 on Mac OS X 10.12.6. Servus, Walter |
From: Anthony T. <ant...@gm...> - 2017-08-18 17:28:34
|
What is cx_Oracle? cx_Oracle is a Python extension module that enables access to Oracle Database for Python 3.x and 2.x and conforms to the Python database API 2.0 specifications with a number of enhancements. Where do I get it? https://oracle.github.io/python-cx_Oracle The easiest method to install cx_Oracle is via pip as in python -m pip install cx_Oracle --upgrade What's new? This release addresses issues found since the production release was made. The full release notes can be read here: http://cx-oracle.readthedocs.io/en/latest/releasenotes.html#version-6-0-1-august-2017 Please provide any feedback via GitHub issues (https://github.com/oracle/pyt hon-cx_Oracle/issues). |
From: Anthony T. <ant...@gm...> - 2017-08-14 22:33:11
|
What is cx_Oracle? cx_Oracle is a Python extension module that enables access to Oracle Database for Python 3.x and 2.x and conforms to the Python database API 2.0 specifications with a number of enhancements. Where do I get it? https://oracle.github.io/python-cx_Oracle The easiest method to install cx_Oracle 6.0 is via pip as in python -m pip install cx_Oracle --upgrade What's new since 5.3? This is the first production release of version 6.0. The complete release notes can be found here: http://cx-oracle.readthe docs.io/en/latest/releasenotes.html#version-6-0-august-2017. A summary of the changes compared to version 5.3 is found below: *Highlighted Enhancements* - Has been re-implemented to use the new ODPI-C ( https://oracle.github.io/odpi) abstraction layer for Oracle Database. The cx_Oracle API is unchanged. The cx_Oracle design, build and linking process has improved because of ODPI-C. - Now has Python Wheels available for install. This is made possible by the ODPI-C architecture. Windows installers and Linux RPMs are no longer produced since PyPI no longer supports them. - Has less code in Python's Global Interpreter Lock, giving better scalability. - Added support for universal rowids. - Added support for DML returning of multiple rows. - Now associates LOB locators to LOB objects so they are not overwritten on database round trips. *Installation Changes* - On Linux, cx_Oracle 6 no longer uses instant client RPMs automatically. You must set LD_LIBRARY_PATH or use ldconfig to locate the Oracle Client library. - On platforms other than Windows, if ORACLE_HOME is set (in a database or full client installation), remove requirement to set LD_LIBRARY_PATH in order to locate the Oracle Client library (https://github.com/oracle/odp i/issues/20). *Connection Management Enhancements* - Prevent closing the connection when there are any open statements or LOBs and add new error "DPI-1054: connection cannot be closed when open statements or LOBs exist" when this situation is detected; this is needed to prevent crashes under certain conditions when statements or LOBs are being acted upon while at the same time (in another thread) a connection is being closed; it also prevents leaks of statements and LOBs when a connection is returned to a session pool. - Added attribute SessionPool.stmtcachesize to support getting and setting the default statement cache size for connections in the pool. - Added attribute Connection.dbop to support setting the database operation that is to be monitored. - Added attribute Connection.handle to facilitate testing the creation of a connection using a OCI service context handle. - Added parameters tag and matchanytag to the cx_Oracle.connect and SessionPool.acquire methods and added parameters tag and retag to the SessionPool.release method in order to support session tagging. - Added parameter edition to the cx_Oracle.SessionPool method. - Added parameters region, sharding_key and super_sharding_key to the cx_Oracle.makedsn() method to support connecting to a sharded database (new in Oracle Database 12.2). - Removed requirement that encoding and nencoding both be specified when creating a connection or session pool. The missing value is set to its default value if one of the values is set and the other is not ( https://github.com/oracle/python-cx_Oracle/issues/36). - Permit use of both string and unicode for Python 2.7 for creating session pools and for changing passwords (https://github.com/oracle/pyt hon-cx_Oracle/issues/23). *Data Type and Data Handling Enhancements* - Added attributes Variable.actualElements and Variable.values to variables. - Added support for smallint and float data types in Oracle objects, as requested (https://github.com/oracle/python-cx_Oracle/issues/4). - Added support for getting/setting attributes of objects or element values in collections that contain LOBs, BINARY_FLOAT values, BINARY_DOUBLE values and NCHAR and NVARCHAR2 values. The error message for any types that are not supported has been improved as well. - An exception is no longer raised when a collection is empty for methods Object.first() and Object.last(). Instead, the value None is returned to be consistent with the methods Object.next() and Object.prev(). - Removed requirement for specifying a maximum size when fetching LONG or LONG raw columns. This also allows CLOB, NCLOB, BLOB and BFILE columns to be fetched as strings or bytes without needing to specify a maximum size. The method Cursor.setoutputsize no longer does anything, since ODPI-C automatically manages buffer sizes of LONG and LONG RAW columns. - Enable temporary LOB caching in order to avoid disk I/O as suggested ( https://github.com/oracle/odpi/issues/10). *Error Handling Enhancements* - Provide improved error message when OCI environment cannot be created, such as when the oraaccess.xml file cannot be processed properly. - Define exception classes on the connection object in addition to at module scope in order to simplify error handling in multi-connection environments, as specified in the Python DB API. *Test Enhancements* - Reworked test suite and samples so that they are independent of each other and so that the SQL scripts used to create/drop schemas are easily adjusted to use different schema names, if desired. - Updated DB API test suite stub to support Python 3. *Removals* - Dropped deprecated parameter twophase from the cx_Oracle.connect method. Applications should set the Connection.internal_name and Connection.external_name attributes instead to a value appropriate to the application. - Dropped deprecated parameters action, module and clientinfo from the cx_Oracle.connect method. The appcontext parameter should be used instead. - Dropped deprecated attribute numbersAsString from cursor objects. Use an output type handler instead. - Dropped deprecated attributes cqqos and rowids from subscription objects. Use the qos attribute instead. - Dropped deprecated parameters cqqos and rowids from the Connection.subscribe() method. Use the qos parameter instead. |
From: Anthony T. <ant...@gm...> - 2017-07-24 17:53:00
|
What is cx_Oracle? cx_Oracle is a Python extension module that enables access to Oracle Database for Python 3.x and 2.x and conforms to the Python database API 2.0 specifications with a number of enhancements. Where do I get it? https://oracle.github.io/python-cx_Oracle The easiest method to install cx_Oracle 6.0rc1 is via pip as in python -m pip install cx_Oracle --upgrade --pre Note that the --pre option is required since this is a prerelease. What's new? This release continues to focus on correcting issues discovered over the past month and polishing items in preparation for a production release. The full release notes can be read here: http://cx-oracle.readthedocs.io/en/latest/releasenotes.html#version-6-0-rc-2-july-2017 Please provide any feedback via GitHub issues (https://github.com/oracle/ python-cx_Oracle/issues). |
From: Walter D. <wa...@li...> - 2017-07-13 10:07:27
|
On 12 Jul 2017, at 0:24, Anthony Tuininga wrote: > On Tue, Jul 11, 2017 at 7:49 AM, Walter Dörwald > <wa...@li...> > wrote: > >> On 6 Jul 2017, at 19:11, Anthony Tuininga wrote: >> >> [...] >> >>> Thanks. I have downloaded VS 2017 and will attempt to build with it. >>> I >>> know that Python itself was built with VS 2015 so that >>> redistributable will be >>> needed but the 2017 one will also probably be needed. I'll let you >>> know if >>> I am able to replicate your issue. >> >> Any luck so far? > > I was able to get VS 2017 and was able to compile cx_Oracle with it. I > didn't run into any problems at all. I was using an instant client, > however, so not sure if that has any bearing. > >> What we could try is to use the Oracle Instant Client instead of >> Oracle 11 >> XE and see if this changes anything. > > Please let us know if this does change things in any way. > > A new release will be made sometime next week, if at all possible, so > you > can get binary releases directly for it with this and other fixes > included > in it. There will also be some updated documentation on installation > which > will encapsulate some of this information -- so if you do find out > that > Oracle 11 XE is the culprit it would be very good to know! Thanks. OK, we've installed an Instant Client, removed Oracle XE from the path and added the Instant Client instead. We also put a tnsnames.ora file in the Instant Client directory. The result >>> import cx_Oracle Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded: Das angegebene Modul wurde nicht gefunden. See https://oracle.github.io/odpi/doc/installation.html for help I.e. we get another error message: "Das angegebene Modul wurde nicht gefunden" means "The specified module wasn't found". If we start the sqlplus.exe that is part of the Oracle Instant Client, it sits there for several seconds and then displays the following dialog: http://styx.livinglogic.de/~walter/cx_Oracle/sqlplus_dialog.png which basically says "MSVCR100.dll not found". After we've copied MSVCR100.dll from some other directory (Sublime Text in the case) to the Instant Client directory, importing cx_Oracle did work, and we could do db queries with it. Copying MSVCR100.dll to the Oracle XE directory however doesn't change anything. (The Oracle XE directory does contain MSVCR71.dll, but whether this is good, bad, or irrelevant, I don't know). > [...] Servus, Walter |
From: Andrew Z. <fo...@gm...> - 2017-07-12 18:03:30
|
Hello, Are there any examples how to connect to timesten the? Thank you |
From: Anthony T. <ant...@gm...> - 2017-07-11 22:24:36
|
On Tue, Jul 11, 2017 at 7:49 AM, Walter Dörwald <wa...@li...> wrote: > On 6 Jul 2017, at 19:11, Anthony Tuininga wrote: > > On Thu, Jul 6, 2017 at 9:48 AM, Walter Dörwald <wa...@li...> >> wrote: >> >> On 6 Jul 2017, at 0:45, Anthony Tuininga wrote: >>> >>> On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga < >>> >>>> ant...@gm... >>>> [...] >>>> Just to be clear since the process is a bit different now: in your >>>> cx_Oracle repository you need to issue the following commands: >>>> >>>> git pull >>>> git submodule update >>>> >>>> >>> "git submodule update" doesn't seem to do anything. Do we need a special >>> git configuration for that? >>> >>> >> No. But if you didn't initialise the submodule when you first cloned >> cx_Oracle that would happen. The correct steps for initial cloning is as >> follows: >> >> git clone https://github.com/oracle/python-cx_Oracle.git cx_Oracle >> cd cx_Oracle >> git submodule init >> >> Making odpi empty and doing "git clone https://github.com/oracle/odpi" >>> helps. >>> >> >> The submodule is used so that you get the right version of ODPI-C. Right >> now there aren't any incompatible changes in ODPI-C but that will change >> in >> the future. So you don't want to do this long-term! >> > > OK, that works. Excellent. > > > That will update ODPI-C (where the correction was made) as well as >>> >>>> cx_Oracle itself. >>>> >>>> >>> With this (and a python -v), we do indeed get the following: >>> >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >>> File "<frozen importlib._bootstrap>", line 950, in >>> _find_and_load_unlocked >>> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >>> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >>> File "<frozen importlib._bootstrap_external>", line 922, in >>> create_module >>> File "<frozen importlib._bootstrap>", line 205, in >>> _call_with_frames_removed >>> cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be >>> loaded: >>> %1 ist keine zulässige Win32-Anwendung. See >>> https://oracle.github.io/odpi/ >>> doc/installation.html for help >>> >> >> Excellent. Thanks for confirming. >> >> >>> [...] >>> >>>> And of cause it would help if %1 was resolved to a useful filename. >>>>>>> >>>>>>> >>>>>> Naturally. But that information isn't directly provided. I'll look >>>>>> into >>>>>> that, too. >>>>>> >>>>>> >>>>> This is a limitation of Windows and there isn't much that can be done >>>>> about it. Sorry! >>>>> >>>>> >>>> May be the %1 is supposed to be the argument that was passed to >>> LoadLibrary()? >>> >>> >> I believe it is supposed to refer to the *actual* DLL that caused the >> problem -- but as far as I know there isn't a way to get this value. The >> value passed to LoadLibrary() is simply "oci.dll" so that doesn't help >> much. >> > > True, and the error could be a completely unrelated one. It seems that the > Windows error API is not well thought out. Unfortunately, yes. :-( > > > The installation documentation linked to in the error message gives >> you that much! >> >>> >>> According to the documentation of FormatMessageW() at >>> >>> https://msdn.microsoft.com/en-us/library/windows/desktop/ >>> ms679351(v=vs.85).aspx >>> >>> it should by possible to pass in arguments to FormatMessageW() in the >>> last >>> parameter. >>> >>> >> Yes, it does. >> >> >>> At least this would mean that the user gets to see the path to the >>> cx_Oracle DLL. >>> >>> >> But how does one get that information? As far as I know there isn't a way >> to get it. See the comments here: >> https://stackoverflow.com/questions/6190105/formatmessage- >> with-placeholders. >> >> >>> Of course it would be better, if we could see which DLL ultimately is the >>> problem. >>> >> >> Definitely! Too bad Microsoft doesn't provide that information. :-( >> >> >> >>> But now for the real error... >>> >>>> >>>>>>> [...] >>>>>>> >>>>>>> >>>>>>>> You can use this tool: http://www.dependencywalker.com/ which will >>>>>>>> tell you >>>>>>>> what dependencies the cx_Oracle.pyd file and all of their >>>>>>>> dependencies, >>>>>>>> too. Hopefully it helps. >>>>>>>> >>>>>>>> >>>>>>>> OK, we tried that. The output is here: >>>>>>> >>>>>>> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >>>>>>> -win_amd64.txt >>>>>>> >>>>>>> dependencywalker seem that have many problems with this DLL, but what >>>>>>> sticks out is VCRUNTIME140.dll. This seems to be part of the "Visual >>>>>>> C++ >>>>>>> Redistributable for Visual Studio 2015" which we downloaded from >>>>>>> here: >>>>>>> >>>>>>> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >>>>>>> >>>>>>> (we've downloaded vc_redist.x64.exe). When we install it, it >>>>>>> complains >>>>>>> that another version is already installed. After we've uninstalled >>>>>>> the >>>>>>> 2017 >>>>>>> Redistributables installation works, but the output of "import >>>>>>> cx_Oracle" >>>>>>> remains the same. >>>>>>> >>>>>>> >>>>>>> So the problem isn't resolved by the change of VS redistributable. >>>>>> Can >>>>>> you take a look in the event log? Can you also provide a list of all >>>>>> of >>>>>> the >>>>>> VS redistributables you have installed? I am going to try to replicate >>>>>> this >>>>>> myself. >>>>>> >>>>>> >>>>> OK, the list is here: >>> >>> http://styx.livinglogic.de/~walter/cx_Oracle/VCRedistributables.png >>> >>> >>> Thanks. I have downloaded VS 2017 and will attempt to build with it. I >> know >> that Python itself was built with VS 2015 so that redistributable will be >> needed but the 2017 one will also probably be needed. I'll let you know if >> I am able to replicate your issue. >> > > Any luck so far? > I was able to get VS 2017 and was able to compile cx_Oracle with it. I didn't run into any problems at all. I was using an instant client, however, so not sure if that has any bearing. > > What we could try is to use the Oracle Instant Client instead of Oracle 11 > XE and see if this changes anything. Please let us know if this does change things in any way. A new release will be made sometime next week, if at all possible, so you can get binary releases directly for it with this and other fixes included in it. There will also be some updated documentation on installation which will encapsulate some of this information -- so if you do find out that Oracle 11 XE is the culprit it would be very good to know! Thanks. > > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Walter D. <wa...@li...> - 2017-07-11 13:49:37
|
On 6 Jul 2017, at 19:11, Anthony Tuininga wrote: > On Thu, Jul 6, 2017 at 9:48 AM, Walter Dörwald > <wa...@li...> > wrote: > >> On 6 Jul 2017, at 0:45, Anthony Tuininga wrote: >> >> On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga < >>> ant...@gm... >>> [...] >>> Just to be clear since the process is a bit different now: in your >>> cx_Oracle repository you need to issue the following commands: >>> >>> git pull >>> git submodule update >>> >> >> "git submodule update" doesn't seem to do anything. Do we need a >> special >> git configuration for that? >> > > No. But if you didn't initialise the submodule when you first cloned > cx_Oracle that would happen. The correct steps for initial cloning is > as > follows: > > git clone https://github.com/oracle/python-cx_Oracle.git cx_Oracle > cd cx_Oracle > git submodule init > >> Making odpi empty and doing "git clone >> https://github.com/oracle/odpi" >> helps. > > The submodule is used so that you get the right version of ODPI-C. > Right > now there aren't any incompatible changes in ODPI-C but that will > change in > the future. So you don't want to do this long-term! OK, that works. >> That will update ODPI-C (where the correction was made) as well as >>> cx_Oracle itself. >>> >> >> With this (and a python -v), we do indeed get the following: >> >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >> File "<frozen importlib._bootstrap>", line 950, in >> _find_and_load_unlocked >> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >> File "<frozen importlib._bootstrap_external>", line 922, in >> create_module >> File "<frozen importlib._bootstrap>", line 205, in >> _call_with_frames_removed >> cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be >> loaded: >> %1 ist keine zulässige Win32-Anwendung. See >> https://oracle.github.io/odpi/ >> doc/installation.html for help > > Excellent. Thanks for confirming. > >> >> [...] >>>>>> And of cause it would help if %1 was resolved to a useful >>>>>> filename. >>>>>> >>>>> >>>>> Naturally. But that information isn't directly provided. I'll look >>>>> into >>>>> that, too. >>>>> >>>> >>>> This is a limitation of Windows and there isn't much that can be >>>> done >>>> about it. Sorry! >>>> >>> >> May be the %1 is supposed to be the argument that was passed to >> LoadLibrary()? >> > > I believe it is supposed to refer to the *actual* DLL that caused the > problem -- but as far as I know there isn't a way to get this value. > The > value passed to LoadLibrary() is simply "oci.dll" so that doesn't help > much. True, and the error could be a completely unrelated one. It seems that the Windows error API is not well thought out. > The installation documentation linked to in the error message gives > you that much! >> >> According to the documentation of FormatMessageW() at >> >> https://msdn.microsoft.com/en-us/library/windows/desktop/ >> ms679351(v=vs.85).aspx >> >> it should by possible to pass in arguments to FormatMessageW() in the >> last >> parameter. >> > > Yes, it does. > >> >> At least this would mean that the user gets to see the path to the >> cx_Oracle DLL. >> > > But how does one get that information? As far as I know there isn't a > way > to get it. See the comments here: > https://stackoverflow.com/questions/6190105/formatmessage-with-placeholders. > >> >> Of course it would be better, if we could see which DLL ultimately is >> the >> problem. > > Definitely! Too bad Microsoft doesn't provide that information. :-( > > >> >> But now for the real error... >>>>>> >>>>>> [...] >>>>>> >>>>>>> >>>>>>> You can use this tool: http://www.dependencywalker.com/ which >>>>>>> will >>>>>>> tell you >>>>>>> what dependencies the cx_Oracle.pyd file and all of their >>>>>>> dependencies, >>>>>>> too. Hopefully it helps. >>>>>>> >>>>>>> >>>>>> OK, we tried that. The output is here: >>>>>> >>>>>> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >>>>>> -win_amd64.txt >>>>>> >>>>>> dependencywalker seem that have many problems with this DLL, but >>>>>> what >>>>>> sticks out is VCRUNTIME140.dll. This seems to be part of the >>>>>> "Visual >>>>>> C++ >>>>>> Redistributable for Visual Studio 2015" which we downloaded from >>>>>> here: >>>>>> >>>>>> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >>>>>> >>>>>> (we've downloaded vc_redist.x64.exe). When we install it, it >>>>>> complains >>>>>> that another version is already installed. After we've >>>>>> uninstalled the >>>>>> 2017 >>>>>> Redistributables installation works, but the output of "import >>>>>> cx_Oracle" >>>>>> remains the same. >>>>>> >>>>>> >>>>> So the problem isn't resolved by the change of VS redistributable. >>>>> Can >>>>> you take a look in the event log? Can you also provide a list of >>>>> all of >>>>> the >>>>> VS redistributables you have installed? I am going to try to >>>>> replicate >>>>> this >>>>> myself. >>>>> >>>> >> OK, the list is here: >> >> http://styx.livinglogic.de/~walter/cx_Oracle/VCRedistributables.png >> >> > Thanks. I have downloaded VS 2017 and will attempt to build with it. I > know > that Python itself was built with VS 2015 so that redistributable will > be > needed but the 2017 one will also probably be needed. I'll let you > know if > I am able to replicate your issue. Any luck so far? What we could try is to use the Oracle Instant Client instead of Oracle 11 XE and see if this changes anything. Servus, Walter |
From: Anthony T. <ant...@gm...> - 2017-07-06 17:11:58
|
On Thu, Jul 6, 2017 at 9:48 AM, Walter Dörwald <wa...@li...> wrote: > On 6 Jul 2017, at 0:45, Anthony Tuininga wrote: > > On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga < >> ant...@gm... >> >>> wrote: >>> >> >> [...] >>> I have discovered the source of the problem. I was able to replicate the >>> issue thanks to this pointer and have corrected it in the source. If you >>> can do a new pull and compile you should get the correct error message >>> now. >>> If you can confirm that would be helpful! Thanks. >>> >>> >> Just to be clear since the process is a bit different now: in your >> cx_Oracle repository you need to issue the following commands: >> >> git pull >> git submodule update >> > > "git submodule update" doesn't seem to do anything. Do we need a special > git configuration for that? > No. But if you didn't initialise the submodule when you first cloned cx_Oracle that would happen. The correct steps for initial cloning is as follows: git clone https://github.com/oracle/python-cx_Oracle.git cx_Oracle cd cx_Oracle git submodule init > Making odpi empty and doing "git clone https://github.com/oracle/odpi" > helps. The submodule is used so that you get the right version of ODPI-C. Right now there aren't any incompatible changes in ODPI-C but that will change in the future. So you don't want to do this long-term! > > > That will update ODPI-C (where the correction was made) as well as >> cx_Oracle itself. >> > > With this (and a python -v), we do indeed get the following: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "<frozen importlib._bootstrap>", line 961, in _find_and_load > File "<frozen importlib._bootstrap>", line 950, in > _find_and_load_unlocked > File "<frozen importlib._bootstrap>", line 648, in _load_unlocked > File "<frozen importlib._bootstrap>", line 560, in module_from_spec > File "<frozen importlib._bootstrap_external>", line 922, in > create_module > File "<frozen importlib._bootstrap>", line 205, in > _call_with_frames_removed > cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded: > %1 ist keine zulässige Win32-Anwendung. See https://oracle.github.io/odpi/ > doc/installation.html for help > Excellent. Thanks for confirming. > > [...] >>>>> And of cause it would help if %1 was resolved to a useful filename. >>>>> >>>> >>>> Naturally. But that information isn't directly provided. I'll look into >>>> that, too. >>>> >>> >>> This is a limitation of Windows and there isn't much that can be done >>> about it. Sorry! >>> >> > May be the %1 is supposed to be the argument that was passed to > LoadLibrary()? > I believe it is supposed to refer to the *actual* DLL that caused the problem -- but as far as I know there isn't a way to get this value. The value passed to LoadLibrary() is simply "oci.dll" so that doesn't help much. The installation documentation linked to in the error message gives you that much! > > According to the documentation of FormatMessageW() at > > https://msdn.microsoft.com/en-us/library/windows/desktop/ > ms679351(v=vs.85).aspx > > it should by possible to pass in arguments to FormatMessageW() in the last > parameter. > Yes, it does. > > At least this would mean that the user gets to see the path to the > cx_Oracle DLL. > But how does one get that information? As far as I know there isn't a way to get it. See the comments here: https://stackoverflow.com/questions/6190105/formatmessage-with-placeholders. > > Of course it would be better, if we could see which DLL ultimately is the > problem. > Definitely! Too bad Microsoft doesn't provide that information. :-( > > But now for the real error... >>>>> >>>>> [...] >>>>> >>>>>> >>>>>> You can use this tool: http://www.dependencywalker.com/ which will >>>>>> tell you >>>>>> what dependencies the cx_Oracle.pyd file and all of their >>>>>> dependencies, >>>>>> too. Hopefully it helps. >>>>>> >>>>>> >>>>> OK, we tried that. The output is here: >>>>> >>>>> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >>>>> -win_amd64.txt >>>>> >>>>> dependencywalker seem that have many problems with this DLL, but what >>>>> sticks out is VCRUNTIME140.dll. This seems to be part of the "Visual >>>>> C++ >>>>> Redistributable for Visual Studio 2015" which we downloaded from here: >>>>> >>>>> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >>>>> >>>>> (we've downloaded vc_redist.x64.exe). When we install it, it complains >>>>> that another version is already installed. After we've uninstalled the >>>>> 2017 >>>>> Redistributables installation works, but the output of "import >>>>> cx_Oracle" >>>>> remains the same. >>>>> >>>>> >>>> So the problem isn't resolved by the change of VS redistributable. Can >>>> you take a look in the event log? Can you also provide a list of all of >>>> the >>>> VS redistributables you have installed? I am going to try to replicate >>>> this >>>> myself. >>>> >>> > OK, the list is here: > > http://styx.livinglogic.de/~walter/cx_Oracle/VCRedistributables.png > > Thanks. I have downloaded VS 2017 and will attempt to build with it. I know that Python itself was built with VS 2015 so that redistributable will be needed but the 2017 one will also probably be needed. I'll let you know if I am able to replicate your issue. > > [...] >> > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Walter D. <wa...@li...> - 2017-07-06 15:48:38
|
On 6 Jul 2017, at 0:45, Anthony Tuininga wrote: > On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga > <ant...@gm... >> wrote: > >> [...] >> I have discovered the source of the problem. I was able to replicate >> the >> issue thanks to this pointer and have corrected it in the source. If >> you >> can do a new pull and compile you should get the correct error >> message now. >> If you can confirm that would be helpful! Thanks. >> > > Just to be clear since the process is a bit different now: in your > cx_Oracle repository you need to issue the following commands: > > git pull > git submodule update "git submodule update" doesn't seem to do anything. Do we need a special git configuration for that? Making odpi empty and doing "git clone https://github.com/oracle/odpi" helps. > That will update ODPI-C (where the correction was made) as well as > cx_Oracle itself. With this (and a python -v), we do indeed get the following: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 648, in _load_unlocked File "<frozen importlib._bootstrap>", line 560, in module_from_spec File "<frozen importlib._bootstrap_external>", line 922, in create_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded: %1 ist keine zulässige Win32-Anwendung. See https://oracle.github.io/odpi/doc/installation.html for help >>>> [...] >>>> And of cause it would help if %1 was resolved to a useful filename. >>> >>> Naturally. But that information isn't directly provided. I'll look >>> into >>> that, too. >> >> This is a limitation of Windows and there isn't much that can be done >> about it. Sorry! May be the %1 is supposed to be the argument that was passed to LoadLibrary()? According to the documentation of FormatMessageW() at https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx it should by possible to pass in arguments to FormatMessageW() in the last parameter. At least this would mean that the user gets to see the path to the cx_Oracle DLL. Of course it would be better, if we could see which DLL ultimately is the problem. >>>> But now for the real error... >>>> >>>> [...] >>>>> >>>>> You can use this tool: http://www.dependencywalker.com/ which will >>>>> tell you >>>>> what dependencies the cx_Oracle.pyd file and all of their >>>>> dependencies, >>>>> too. Hopefully it helps. >>>>> >>>> >>>> OK, we tried that. The output is here: >>>> >>>> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >>>> -win_amd64.txt >>>> >>>> dependencywalker seem that have many problems with this DLL, but >>>> what >>>> sticks out is VCRUNTIME140.dll. This seems to be part of the >>>> "Visual C++ >>>> Redistributable for Visual Studio 2015" which we downloaded from >>>> here: >>>> >>>> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >>>> >>>> (we've downloaded vc_redist.x64.exe). When we install it, it >>>> complains >>>> that another version is already installed. After we've uninstalled >>>> the 2017 >>>> Redistributables installation works, but the output of "import >>>> cx_Oracle" >>>> remains the same. >>>> >>> >>> So the problem isn't resolved by the change of VS redistributable. >>> Can >>> you take a look in the event log? Can you also provide a list of all >>> of the >>> VS redistributables you have installed? I am going to try to >>> replicate this >>> myself. OK, the list is here: http://styx.livinglogic.de/~walter/cx_Oracle/VCRedistributables.png > [...] Servus, Walter |
From: Walter D. <wa...@li...> - 2017-07-06 09:56:10
|
On 6 Jul 2017, at 10:57, Oscar Rubio wrote: > Hello > > I have been trying to install and build up the Cx_Oracle package, on > my > company computer, > usuing Windows64 bits, Anaconda package and python3.6.1 versions. > > I did the following to build up the last package in the Pypi > repository > > conda skeleton pypi cx_Oracle > > af5f7daad67d6820670d582dfc045/cx_Oracle-6.0rc1.tar.gz (200 KB) for > cx_Oracle. > > Downloading cx_Oracle > > Using cached download > > Unpacking cx_Oracle... > > done > > > I have installed Oracle install client as well, > > > and when I am checking the file/ directory is finally set, I see it > there > > File > "C:\Anaconda3_version4.3\lib\site-packages\conda_build\skeletons\pypi.py", > line 339, in skeletonize > raise RuntimeError("directory already exists: %s" % > dir_path)RuntimeError: directory already exists: .\cx_oracle > > but when I am calling it, it cannot be found > > import cx_oracleTraceback (most recent call last): > > File "<ipython-input-3-fa7af752f8a0>", line 1, in <module> > import cx_oracle Maybe this should be "import cx_Oracle" (i.e. uppercase O)? > ModuleNotFoundError: No module named 'cx_oracle' > > [...] > > Regards > > Oscar Servus, Walter |
From: Jani T. <re...@gm...> - 2017-07-06 09:10:39
|
Hi, Building cx_Oracle requires you to have working C(++) compiler since cx_Oracle is written in C, not in Python even it's a Python module. On 06.07.2017 11:57, Oscar Rubio wrote: > Hello > > I have been trying to install and build up the Cx_Oracle package, on > my company computer, > usuing Windows64 bits, Anaconda package and python3.6.1 versions. > > I did the following to build up the last package in the Pypi repository > > conda skeleton pypi cx_Oracle > > af5f7daad67d6820670d582dfc045/cx_Oracle-6.0rc1.tar.gz (200 KB) for > cx_Oracle. > > Downloading cx_Oracle > > Using cached download > > Unpacking cx_Oracle... > > done > > > > I have installed Oracle install client as well, > > > and when I am checking the file/ directory is finally set, I see it there > > |File"C:\Anaconda3_version4.3\lib\site-packages\conda_build\skeletons\pypi.py",line > 339,inskeletonize raiseRuntimeError("directory already exists: > %s"%dir_path)RuntimeError:directory already exists:.\cx_oracle| > > but when I am calling it, it cannot be found > > |importcx_oracle Traceback(most recent call > last):File"<ipython-input-3-fa7af752f8a0>",line > 1,in<module>importcx_oracle ModuleNotFoundError:Nomodule named > 'cx_oracle'| > > The directory of cx_Oracle contains the files, and know I need to > build the package with conda build: > > conda build cx_Oracle > > Just so, it still doesn't work > > Provides me the following error: > > |Anaconda3_version4.3\conda-bld\cx_oracle_1499164 > 353203\_b_env\Library\include /Tcsrc/cx_Oracle.c > /Fobuild\temp.win-amd64-3.6\Rel ease\src/cx_Oracle.obj > -DBUILD_VERSION=6.0rc1error:command 'cl.exe'failed:Nosuch file > ordirectory| > > I do not understand what else is needed to finally install the package, > > as I see "error:command 'cl.exe'failed:Nosuch file ordirectory" > > is related to a Visual C++ compiler, which I have not installed, as I > am not doing anythin with VC+ > > > Is this question suitable for this forum ? I do not find any solution yet. > > > Regards > > Oscar > > > > -- > ----------------------------------- > Oscar Rubio Pons. > osc...@gm... <mailto:osc...@gm...> > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Jani Tiainen |
From: Oscar R. <osc...@gm...> - 2017-07-06 08:57:19
|
Hello I have been trying to install and build up the Cx_Oracle package, on my company computer, usuing Windows64 bits, Anaconda package and python3.6.1 versions. I did the following to build up the last package in the Pypi repository conda skeleton pypi cx_Oracle af5f7daad67d6820670d582dfc045/cx_Oracle-6.0rc1.tar.gz (200 KB) for cx_Oracle. Downloading cx_Oracle Using cached download Unpacking cx_Oracle... done I have installed Oracle install client as well, and when I am checking the file/ directory is finally set, I see it there File "C:\Anaconda3_version4.3\lib\site-packages\conda_build\skeletons\pypi.py", line 339, in skeletonize raise RuntimeError("directory already exists: %s" % dir_path)RuntimeError: directory already exists: .\cx_oracle but when I am calling it, it cannot be found import cx_oracleTraceback (most recent call last): File "<ipython-input-3-fa7af752f8a0>", line 1, in <module> import cx_oracle ModuleNotFoundError: No module named 'cx_oracle' The directory of cx_Oracle contains the files, and know I need to build the package with conda build: conda build cx_Oracle Just so, it still doesn't work Provides me the following error: Anaconda3_version4.3\conda-bld\cx_oracle_1499164353203\_b_env\Library\include /Tcsrc/cx_Oracle.c /Fobuild\temp.win-amd64-3.6\Rel ease\src/cx_Oracle.obj -DBUILD_VERSION=6.0rc1 error: command 'cl.exe' failed: No such file or directory I do not understand what else is needed to finally install the package, as I see "error: command 'cl.exe' failed: No such file or directory" is related to a Visual C++ compiler, which I have not installed, as I am not doing anythin with VC+ Is this question suitable for this forum ? I do not find any solution yet. Regards Oscar -- ----------------------------------- Oscar Rubio Pons. osc...@gm... |
From: Anthony T. <ant...@gm...> - 2017-07-05 22:46:03
|
On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga <ant...@gm... > wrote: > On Wed, Jul 5, 2017 at 8:21 AM, Anthony Tuininga < > ant...@gm...> wrote: > >> >> >> On Wed, Jul 5, 2017 at 6:29 AM, Walter Dörwald <wa...@li...> >> wrote: >> >>> On 4 Jul 2017, at 16:35, Anthony Tuininga wrote: >>> >>> On Tue, Jul 4, 2017 at 3:18 AM, Walter Dörwald <wa...@li...> >>>> wrote: >>>> >>>> On 3 Jul 2017, at 15:59, Anthony Tuininga wrote: >>>>> >>>>> Hi Walter, >>>>> >>>>>> >>>>>> DPI_DEBUG_LEVEL=7 causes a bunch of output that tells me which public >>>>>> ODPI-C functions are being called. The fact that you are not getting >>>>>> any >>>>>> at >>>>>> all suggests something is going wrong even before cx_Oracle code is >>>>>> involved. Can you try a few more things? >>>>>> >>>>>> 1) Use python -v so you can see if the error is occurring prior to the >>>>>> actual import of cx_Oracle (it may not help but it might, too) >>>>>> >>>>>> >>>>> Here is the output of importing cx_Oracle in a verbose Python session: >>>>> [...] >>>>> Traceback (most recent call last): >>>>> File "<stdin>", line 1, in <module> >>>>> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >>>>> File "<frozen importlib._bootstrap>", line 950, in >>>>> _find_and_load_unlocked >>>>> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >>>>> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >>>>> File "<frozen importlib._bootstrap_external>", line 922, in >>>>> create_module >>>>> File "<frozen importlib._bootstrap>", line 205, in >>>>> _call_with_frames_removed >>>>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position >>>>> 66: >>>>> invalid continuation byte >>>>> >>>>> >>>> Looks like it may have started running code in the module as the first >>>> thing it does is imports the datetime and decimal modules. If you're >>>> able >>>> to add some printf() statements at key positions in the >>>> Module_Initialize() >>>> function in src/cx_Oracle.c that would be helpful. In particular, at the >>>> very beginning (to confirm that it is running), after the imports, after >>>> the PyModule_Create() call, just prior to the dpiContext_create() call, >>>> just after it, and just at the end. I wish I could replicate this >>>> myself! >>>> >>> >>> We've found the spot where the error occurs with the following patch: >>> >>> ============================================================ >>> ==================== >>> >>> C:\checkouts\python-cx_Oracle\odpi>git diff >>> diff --git a/src/dpiOci.c b/src/dpiOci.c >>> index f881bed..e588b1c 100644 >>> --- a/src/dpiOci.c >>> +++ b/src/dpiOci.c >>> @@ -1338,6 +1338,7 @@ static int dpiOci__loadLib(dpiError *error) >>> #ifdef _WIN32 >>> DWORD length, errorNum; >>> #endif >>> + printf("Start dpiOci__loadLib()\n"); >>> >>> // dynamically load the OCI library >>> for (i = 0; !dpiOciLibHandle; i++) { >>> @@ -1356,6 +1357,7 @@ static int dpiOci__loadLib(dpiError *error) >>> if (length > 3) >>> loadError[length - 3] = '\0'; >>> else strcpy(loadError, "DLL load failed"); >>> + printf("loadError: %s\n",loadError); >>> } >>> #else >>> dpiOciLibHandle = dlopen(libName, RTLD_LAZY); >>> @@ -1370,6 +1372,7 @@ static int dpiOci__loadLib(dpiError *error) >>> return dpiError__set(error, "load library", >>> DPI_ERR_LOAD_LIBRARY, >>> loadError); >>> >>> + printf("After LoadLibrary()\n"); >>> // validate library >>> if (dpiOci__loadLibValidate(error) < 0) { >>> #ifdef _WIN32 >>> >>> ============================================================ >>> ==================== >>> >>> With this patch, we get the following output: >>> >>> ============================================================ >>> ==================== >>> >>> import cx_Oracle >>>>>> >>>>> Start dpiOci__loadLib() >>> loadError: %1 ist keine zulõssige Win32-Anwendung >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >>> File "<frozen importlib._bootstrap>", line 950, in >>> _find_and_load_unlocked >>> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >>> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >>> File "<frozen importlib._bootstrap_external>", line 922, in >>> create_module >>> File "<frozen importlib._bootstrap>", line 205, in >>> _call_with_frames_removed >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 66: >>> invalid continuation byte >>> >>> ============================================================ >>> ==================== >>> >>> "%1 ist keine zulõssige Win32-Anwendung" (which should read "%1 ist >>> keine zulässige Win32-Anwendung", i.e. the "ö" should be an "ä") means "%1 >>> is not an acceptable win32 application". >>> >>> So we don't see the real problem because cx_Oracle fails to create the >>> proper Unicode string from the OS error message. >>> >>> It's not clear what encoding this is (probable latin-1 or cp1252, but >>> definitely *not* UTF-8). A >>> >>> grep 'xe4.*LATIN SMALL LETTER A WITH DIAERESIS' Lib/encodings/*.py >>> >>> in the Python source code returns 40 encodings that map the byte 0xE4 to >>> ä. >>> >>> If the correct encoding can't be determined from the environment it >>> might be best to use a less strict error handling (like e.g. >>> backslashreplace) when decoding the bytes of the error message. >>> >> >> Thanks, Walter. This is very helpful. We'll have to see what makes the >> most sense in this case. Do you see information in the event log regarding >> this error? >> > > I have discovered the source of the problem. I was able to replicate the > issue thanks to this pointer and have corrected it in the source. If you > can do a new pull and compile you should get the correct error message now. > If you can confirm that would be helpful! Thanks. > Just to be clear since the process is a bit different now: in your cx_Oracle repository you need to issue the following commands: git pull git submodule update That will update ODPI-C (where the correction was made) as well as cx_Oracle itself. > > >> >> >>> >>> And of cause it would help if %1 was resolved to a useful filename. >>> >> >> Naturally. But that information isn't directly provided. I'll look into >> that, too. >> > > This is a limitation of Windows and there isn't much that can be done > about it. Sorry! > > >> >> >>> >>> But now for the real error... >>> >>> [...] >>>> >>>>> >>>>> I also note that you are using VS 2017. Another person noted that >>>>> >>>>>> uninstalling VS 2017 and using an earlier version worked for him -- >>>>>> why >>>>>> that would be is an interesting question (!!?) but if you have a >>>>>> machine >>>>>> that doesn't have VS 2017 but an earlier version that would be worth >>>>>> testing, too. >>>>>> >>>>>> >>>>> We currently don't have a Windows 10 machine without VS 2017, but we're >>>>> going to >>>>> uninstall VS 2017 on this machine and retry with and an older version. >>>>> >>>>> Also, IIRC this exception means that the VS Redistributables are >>>>> missing >>>>> or are >>>>> installed incorrectly. >>>>> >>>>> However I don't know how we can check this. >>>>> >>>> >>>> >>>> You can use this tool: http://www.dependencywalker.com/ which will >>>> tell you >>>> what dependencies the cx_Oracle.pyd file and all of their dependencies, >>>> too. Hopefully it helps. >>>> >>> >>> OK, we tried that. The output is here: >>> >>> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >>> -win_amd64.txt >>> >>> dependencywalker seem that have many problems with this DLL, but what >>> sticks out is VCRUNTIME140.dll. This seems to be part of the "Visual C++ >>> Redistributable for Visual Studio 2015" which we downloaded from here: >>> >>> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >>> >>> (we've downloaded vc_redist.x64.exe). When we install it, it complains >>> that another version is already installed. After we've uninstalled the 2017 >>> Redistributables installation works, but the output of "import cx_Oracle" >>> remains the same. >>> >> >> So the problem isn't resolved by the change of VS redistributable. Can >> you take a look in the event log? Can you also provide a list of all of the >> VS redistributables you have installed? I am going to try to replicate this >> myself. >> >> >>> >>> [...] >>>> >>> >>> Servus, >>> Walter >>> >>> ------------------------------------------------------------ >>> ------------------ >>> Check out the vibrant tech community on one of the world's most >>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >> >> > |
From: Anthony T. <ant...@gm...> - 2017-07-05 22:12:18
|
On Wed, Jul 5, 2017 at 8:21 AM, Anthony Tuininga <ant...@gm... > wrote: > > > On Wed, Jul 5, 2017 at 6:29 AM, Walter Dörwald <wa...@li...> > wrote: > >> On 4 Jul 2017, at 16:35, Anthony Tuininga wrote: >> >> On Tue, Jul 4, 2017 at 3:18 AM, Walter Dörwald <wa...@li...> >>> wrote: >>> >>> On 3 Jul 2017, at 15:59, Anthony Tuininga wrote: >>>> >>>> Hi Walter, >>>> >>>>> >>>>> DPI_DEBUG_LEVEL=7 causes a bunch of output that tells me which public >>>>> ODPI-C functions are being called. The fact that you are not getting >>>>> any >>>>> at >>>>> all suggests something is going wrong even before cx_Oracle code is >>>>> involved. Can you try a few more things? >>>>> >>>>> 1) Use python -v so you can see if the error is occurring prior to the >>>>> actual import of cx_Oracle (it may not help but it might, too) >>>>> >>>>> >>>> Here is the output of importing cx_Oracle in a verbose Python session: >>>> [...] >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in <module> >>>> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >>>> File "<frozen importlib._bootstrap>", line 950, in >>>> _find_and_load_unlocked >>>> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >>>> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >>>> File "<frozen importlib._bootstrap_external>", line 922, in >>>> create_module >>>> File "<frozen importlib._bootstrap>", line 205, in >>>> _call_with_frames_removed >>>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 66: >>>> invalid continuation byte >>>> >>>> >>> Looks like it may have started running code in the module as the first >>> thing it does is imports the datetime and decimal modules. If you're able >>> to add some printf() statements at key positions in the >>> Module_Initialize() >>> function in src/cx_Oracle.c that would be helpful. In particular, at the >>> very beginning (to confirm that it is running), after the imports, after >>> the PyModule_Create() call, just prior to the dpiContext_create() call, >>> just after it, and just at the end. I wish I could replicate this myself! >>> >> >> We've found the spot where the error occurs with the following patch: >> >> ============================================================ >> ==================== >> >> C:\checkouts\python-cx_Oracle\odpi>git diff >> diff --git a/src/dpiOci.c b/src/dpiOci.c >> index f881bed..e588b1c 100644 >> --- a/src/dpiOci.c >> +++ b/src/dpiOci.c >> @@ -1338,6 +1338,7 @@ static int dpiOci__loadLib(dpiError *error) >> #ifdef _WIN32 >> DWORD length, errorNum; >> #endif >> + printf("Start dpiOci__loadLib()\n"); >> >> // dynamically load the OCI library >> for (i = 0; !dpiOciLibHandle; i++) { >> @@ -1356,6 +1357,7 @@ static int dpiOci__loadLib(dpiError *error) >> if (length > 3) >> loadError[length - 3] = '\0'; >> else strcpy(loadError, "DLL load failed"); >> + printf("loadError: %s\n",loadError); >> } >> #else >> dpiOciLibHandle = dlopen(libName, RTLD_LAZY); >> @@ -1370,6 +1372,7 @@ static int dpiOci__loadLib(dpiError *error) >> return dpiError__set(error, "load library", DPI_ERR_LOAD_LIBRARY, >> loadError); >> >> + printf("After LoadLibrary()\n"); >> // validate library >> if (dpiOci__loadLibValidate(error) < 0) { >> #ifdef _WIN32 >> >> ============================================================ >> ==================== >> >> With this patch, we get the following output: >> >> ============================================================ >> ==================== >> >> import cx_Oracle >>>>> >>>> Start dpiOci__loadLib() >> loadError: %1 ist keine zulõssige Win32-Anwendung >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File "<frozen importlib._bootstrap>", line 961, in _find_and_load >> File "<frozen importlib._bootstrap>", line 950, in >> _find_and_load_unlocked >> File "<frozen importlib._bootstrap>", line 648, in _load_unlocked >> File "<frozen importlib._bootstrap>", line 560, in module_from_spec >> File "<frozen importlib._bootstrap_external>", line 922, in >> create_module >> File "<frozen importlib._bootstrap>", line 205, in >> _call_with_frames_removed >> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 66: >> invalid continuation byte >> >> ============================================================ >> ==================== >> >> "%1 ist keine zulõssige Win32-Anwendung" (which should read "%1 ist keine >> zulässige Win32-Anwendung", i.e. the "ö" should be an "ä") means "%1 is not >> an acceptable win32 application". >> >> So we don't see the real problem because cx_Oracle fails to create the >> proper Unicode string from the OS error message. >> >> It's not clear what encoding this is (probable latin-1 or cp1252, but >> definitely *not* UTF-8). A >> >> grep 'xe4.*LATIN SMALL LETTER A WITH DIAERESIS' Lib/encodings/*.py >> >> in the Python source code returns 40 encodings that map the byte 0xE4 to >> ä. >> >> If the correct encoding can't be determined from the environment it might >> be best to use a less strict error handling (like e.g. backslashreplace) >> when decoding the bytes of the error message. >> > > Thanks, Walter. This is very helpful. We'll have to see what makes the > most sense in this case. Do you see information in the event log regarding > this error? > I have discovered the source of the problem. I was able to replicate the issue thanks to this pointer and have corrected it in the source. If you can do a new pull and compile you should get the correct error message now. If you can confirm that would be helpful! Thanks. > > >> >> And of cause it would help if %1 was resolved to a useful filename. >> > > Naturally. But that information isn't directly provided. I'll look into > that, too. > This is a limitation of Windows and there isn't much that can be done about it. Sorry! > > >> >> But now for the real error... >> >> [...] >>> >>>> >>>> I also note that you are using VS 2017. Another person noted that >>>> >>>>> uninstalling VS 2017 and using an earlier version worked for him -- why >>>>> that would be is an interesting question (!!?) but if you have a >>>>> machine >>>>> that doesn't have VS 2017 but an earlier version that would be worth >>>>> testing, too. >>>>> >>>>> >>>> We currently don't have a Windows 10 machine without VS 2017, but we're >>>> going to >>>> uninstall VS 2017 on this machine and retry with and an older version. >>>> >>>> Also, IIRC this exception means that the VS Redistributables are missing >>>> or are >>>> installed incorrectly. >>>> >>>> However I don't know how we can check this. >>>> >>> >>> >>> You can use this tool: http://www.dependencywalker.com/ which will tell >>> you >>> what dependencies the cx_Oracle.pyd file and all of their dependencies, >>> too. Hopefully it helps. >>> >> >> OK, we tried that. The output is here: >> >> http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36 >> -win_amd64.txt >> >> dependencywalker seem that have many problems with this DLL, but what >> sticks out is VCRUNTIME140.dll. This seems to be part of the "Visual C++ >> Redistributable for Visual Studio 2015" which we downloaded from here: >> >> https://www.microsoft.com/en-us/download/details.aspx?id=48145 >> >> (we've downloaded vc_redist.x64.exe). When we install it, it complains >> that another version is already installed. After we've uninstalled the 2017 >> Redistributables installation works, but the output of "import cx_Oracle" >> remains the same. >> > > So the problem isn't resolved by the change of VS redistributable. Can you > take a look in the event log? Can you also provide a list of all of the VS > redistributables you have installed? I am going to try to replicate this > myself. > > >> >> [...] >>> >> >> Servus, >> Walter >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > > |
From: Anthony T. <ant...@gm...> - 2017-07-05 17:00:32
|
On Wed, Jul 5, 2017 at 10:19 AM, Walter Dörwald <wa...@li...> wrote: > On 5 Jul 2017, at 16:21, Anthony Tuininga wrote: > > [...] >>> "%1 ist keine zulõssige Win32-Anwendung" (which should read "%1 ist keine >>> zulässige Win32-Anwendung", i.e. the "ö" should be an "ä") means "%1 is >>> not >>> an acceptable win32 application". >>> >>> So we don't see the real problem because cx_Oracle fails to create the >>> proper Unicode string from the OS error message. >>> >>> It's not clear what encoding this is (probable latin-1 or cp1252, but >>> definitely *not* UTF-8). A >>> >>> grep 'xe4.*LATIN SMALL LETTER A WITH DIAERESIS' Lib/encodings/*.py >>> >>> in the Python source code returns 40 encodings that map the byte 0xE4 to >>> ä. >>> >>> If the correct encoding can't be determined from the environment it might >>> be best to use a less strict error handling (like e.g. backslashreplace) >>> when decoding the bytes of the error message. >>> >>> >> Thanks, Walter. This is very helpful. We'll have to see what makes the >> most >> sense in this case. Do you see information in the event log regarding this >> error? >> > > Where can we find this event log? Search for "Event Viewer". Its a long shot but sometimes errors are displayed there as well, and sometimes they even are useful! :-) > > > [...] >> > > Servus, > Walter > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |