CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
conditionUploadTest.DB Class Reference

Public Member Functions

def __init__ (self, serviceName, schemaName)
 
def connect (self)
 
def getLastInsertedSince (self, tag, snapshot)
 
def removeTag (self, tag)
 
def setSynchronizationType (self, tag, synchType)
 

Public Attributes

 connStr
 
 schemaName
 
 serviceName
 

Detailed Description

Definition at line 15 of file conditionUploadTest.py.

Constructor & Destructor Documentation

◆ __init__()

def conditionUploadTest.DB.__init__ (   self,
  serviceName,
  schemaName 
)

Definition at line 16 of file conditionUploadTest.py.

16  def __init__(self, serviceName, schemaName ):
17  self.serviceName = serviceName
18  self.schemaName = schemaName
19  self.connStr = None
20 

Member Function Documentation

◆ connect()

def conditionUploadTest.DB.connect (   self)

Definition at line 21 of file conditionUploadTest.py.

21  def connect( self ):
22  command = "cmscond_authentication_manager -s %s --list_conn | grep '%s@%s'" %(self.serviceName,self.schemaName,self.serviceName)
23  pipe = subprocess.Popen( command, shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
24  out = pipe.communicate()[0]
25  srvconn = '%s@%s' %(self.schemaName,self.serviceName)
26  rowpwd = out.split(srvconn)[1].split(self.schemaName)[1]
27  pwd = ''
28  for c in rowpwd:
29  if c != ' ' and c != '\n':
30  pwd += c
31  self.connStr = '%s/%s@%s' %(self.schemaName,pwd,self.serviceName)
32 

References conditionUploadTest.DB.connStr, conditionUploadTest.DB.schemaName, conditionUploadTest.DB.serviceName, and submitPVValidationJobs.split().

Referenced by o2o_db_cfgmap.DbManagerDAQ.update_hashmap().

◆ getLastInsertedSince()

def conditionUploadTest.DB.getLastInsertedSince (   self,
  tag,
  snapshot 
)

Definition at line 40 of file conditionUploadTest.py.

40  def getLastInsertedSince( self, tag, snapshot ):
41  db = cx_Oracle.connect(self.connStr)
42  cursor = db.cursor()
43  cursor.execute('SELECT SINCE, INSERTION_TIME FROM IOV WHERE TAG_NAME =:TAG_NAME AND INSERTION_TIME >:TIME ORDER BY INSERTION_TIME DESC',(tag,snapshot))
44  row = cursor.fetchone()
45  return row
46 

References conditionUploadTest.DB.connStr.

◆ removeTag()

def conditionUploadTest.DB.removeTag (   self,
  tag 
)

Definition at line 47 of file conditionUploadTest.py.

47  def removeTag( self, tag ):
48  db = cx_Oracle.connect(self.connStr)
49  cursor = db.cursor()
50  db.begin()
51  cursor.execute('DELETE FROM IOV WHERE TAG_NAME =:TAG_NAME',(tag,))
52  cursor.execute('DELETE FROM TAG_LOG WHERE TAG_NAME=:TAG_NAME',(tag,))
53  cursor.execute('DELETE FROM TAG WHERE NAME=:NAME',(tag,))
54  db.commit()
55 

References conditionUploadTest.DB.connStr.

◆ setSynchronizationType()

def conditionUploadTest.DB.setSynchronizationType (   self,
  tag,
  synchType 
)

Definition at line 33 of file conditionUploadTest.py.

33  def setSynchronizationType( self, tag, synchType ):
34  db = cx_Oracle.connect(self.connStr)
35  cursor = db.cursor()
36  db.begin()
37  cursor.execute('UPDATE TAG SET SYNCHRONIZATION =:SYNCH WHERE NAME =:NAME',(synchType,tag,))
38  db.commit()
39 

References conditionUploadTest.DB.connStr.

Member Data Documentation

◆ connStr

conditionUploadTest.DB.connStr

◆ schemaName

conditionUploadTest.DB.schemaName

Definition at line 18 of file conditionUploadTest.py.

Referenced by conditionUploadTest.DB.connect().

◆ serviceName

conditionUploadTest.DB.serviceName

Definition at line 17 of file conditionUploadTest.py.

Referenced by conditionUploadTest.DB.connect().

submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
DBConfiguration_cff.connect
connect
Definition: DBConfiguration_cff.py:18