Re: [cx-oracle-users] Overwriting connection.action and connection.module?
Brought to you by:
atuining
From: avinash n. <avi...@or...> - 2015-07-24 15:11:00
|
Hello Zoltan, I am not able to reproduce this problem in my setup. (5.2 and Linux with py3 and 2). Here is my script. /import cx_Oracle, time// //con = cx_Oracle.connect("scott/tiger@inst1")// //con.module="query module"// //con.action="dual query"// //cur = con.cursor()// //#cur.execute("select * from emp")// //time.sleep(3) # delay a little// //# now let's supply a new module and action// //con.module="2-query module"// //con.action="2-dual query"// //cur = con.cursor()// //cur.execute("BEGIN GREETINGS(); END;")// // Long query //con.module="3-query module"// // //con.close()/ Can you try an cur.execute() or con.ping() call between the two calls to see if it fixes the problem. Best Regards, Avinash On 7/16/2015 7:29 PM, Zoltan Fedor wrote: > Hi, > I'm having a hard time using connection.action > > I'm a long-time PHP OCI user and just switching over to cx_Oracle. I > always thought that the "action" attribute of the Oracle session is > there to show what action the current query is making, so I always > used it to basically provide a short verbal explanation of what the > query is doing. This is specially useful for ETL-style, long running > queries, so the DBA can see what that query is doing which is running > for over 30 mins now, so he won't just kill it. > > In line with this, in PHP OCI I can have an oracle connection open and > overwrite the "action" attribute everytime a submit a new query (hence > it can be used to describe what the query is doing). > > Unfortunately it seems to me that in cx_Oracle the "connection.action" > (and "connection.module") can only be submitted once and not > overwritten later. > > I'm using cx_Oracle 5.2 in Python 3.4.3 with Oracle 11.2.1 > > See below example code to reproduce. What you will see that while the > query is running the action (and module) in the Oracle $SESSION table > is showing the first value ("dual query") and NOT the second one > ("2-dual query"). > As such, I can only set the action once within a single Oracle > connection, which makes it useless for the purposes of explaining what > the query is doing, because you cannot set it for each query you are > running within the same connection (if you run only one query per > connection, then obviously this is a non-issue). > > /import cx_Oracle, time/ > /con = cx_Oracle.connect("user/password@//oracle_server:1521/test")/ > /con.module="query module"/ > /con.action="dual query"/ > /time.sleep(3) # delay a little/ > /# now let's supply a new module and action/ > /con.module="2-query module" / > /con.action="2-dual query" / > /cur = con.cursor()/ > /cur.execute("""/ > /RUN A QUERY HERE WHICH RUNS FOR LONG ENOUGH FOR YOU TO CHECK THE > SESSION DATA IN ORACLE""") > / > /con.close()/ > > > Would this be a bug or am I doing something wrong here? > > Thanks, > Zoltan > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |