You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi and first of all many thanks for these great modules. In earlier versions I have container support manually. Now it is included and I'm wondering if something like this might be generally helpful. The idea is to not rely on the incoming session to already be in the correct context, but change the container as necessary. For example, we always connect through service registered in PDB. But granting/creating common objects requires changing to root container, which does not have proper service name in our environment. Also, it would make things mor complicated when I need to change the servicename when I want to grant common things.
Long story short, this is the codeblock I added to almost all modules in the main function (sorry, not a pro-coder):
cdb_sql = 'select cdb from v$database'
try:
cursor.execute(cdb_sql)
result = (cursor.fetchone())
if result[0] == 'NO':
container=None
if result[0] == 'YES' and container and container.upper() == 'ALL':
sql = 'ALTER SESSION SET CONTAINER=CDB$ROOT'
cursor.execute(sql)
if result[0] == 'YES' and container and container.upper() not in ['ALL','CURRENT']:
sql = 'ALTER SESSION SET CONTAINER=' + container
cursor.execute(sql)
container=None # Empty container param because we already changed context
except cx_Oracle.DatabaseError as exc:
# Database is probably pre 12.1. Map no container clause and continue
container=None
pass
The text was updated successfully, but these errors were encountered:
Hi and first of all many thanks for these great modules. In earlier versions I have container support manually. Now it is included and I'm wondering if something like this might be generally helpful. The idea is to not rely on the incoming session to already be in the correct context, but change the container as necessary. For example, we always connect through service registered in PDB. But granting/creating common objects requires changing to root container, which does not have proper service name in our environment. Also, it would make things mor complicated when I need to change the servicename when I want to grant common things.
Long story short, this is the codeblock I added to almost all modules in the main function (sorry, not a pro-coder):
The text was updated successfully, but these errors were encountered: