Definition at line 12 of file AtlasGeoDBInterface.py.
◆ __init__()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.__init__ |
( |
|
self, |
|
|
|
dbTag, |
|
|
|
verbose = False |
|
) |
| |
◆ __del__()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.__del__ |
( |
|
self | ) |
|
◆ AnalyseDBRequestOutput_Query()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.AnalyseDBRequestOutput_Query |
( |
|
self, |
|
|
|
request, |
|
|
|
keyName = "" |
|
) |
| |
Analyze request output -> return a list of dictionaries and a list of parameter types
Definition at line 84 of file AtlasGeoDBInterface.py.
84 def AnalyseDBRequestOutput_Query(self,request,keyName=""):
85 """ Analyze request output -> return a list of dictionaries and a list of parameter types """
92 for row
in iter(request.execute()):
95 for j
in range(0,row.size()):
96 name=row[j].specification().
name()
97 paramType=row[j].specification().
typeName()
101 if iCmpt==0: typeList.append((name,paramType))
103 dataList.append(dictLoc)
107 return dataList,typeList
113 v=[d[paramName]
for paramName,tmp
in typeList
if paramName!=keyName]
116 return dataDict,typeList
◆ ConnectAndBrowseGeoDB()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.ConnectAndBrowseGeoDB |
( |
|
self | ) |
|
Definition at line 51 of file AtlasGeoDBInterface.py.
51 def ConnectAndBrowseGeoDB(self):
54 self.ReadGeometryTagId()
55 self.ReadTagAndNodeVersionsFromDB()
◆ ConnectToDB()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.ConnectToDB |
( |
|
self | ) |
|
Definition at line 30 of file AtlasGeoDBInterface.py.
30 def ConnectToDB(self):
32 svc = coral.ConnectionService()
33 svcconfig = svc.configuration()
34 svcconfig.disablePoolAutomaticCleanUp()
35 svcconfig.setConnectionTimeOut(0)
38 if not (
'FRONTIER_SERVER' in os.environ
and os.environ[
'FRONTIER_SERVER']):
39 svcconfig.setConnectionRetrialPeriod(1)
40 svcconfig.setConnectionRetrialTimeOut(1)
42 svcconfig.setConnectionRetrialPeriod(300)
43 svcconfig.setConnectionRetrialTimeOut(3600)
45 self.dbSession = svc.connect(
'ATLASDD', accessMode = coral.access_ReadOnly )
46 transaction = self.dbSession.transaction()
48 self.dbSchema = self.dbSession.nominalSchema()
49 transaction.start(
True)
◆ GetCurrentLeafContent()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.GetCurrentLeafContent |
( |
|
self, |
|
|
|
leafName |
|
) |
| |
Read a DB table content and return 3 lists :
- dbId : the data_id list corresponding to each entry in the table
- dbContent : the table values as a dictionary with keys corresponding to the dbId list
- paramName : the name of the table parameters
Definition at line 171 of file AtlasGeoDBInterface.py.
171 def GetCurrentLeafContent(self, leafName):
172 """ Read a DB table content and return 3 lists :
173 - dbId : the data_id list corresponding to each entry in the table
174 - dbContent : the table values as a dictionary with keys corresponding to the dbId list
175 - paramName : the name of the table parameters """
177 upLeafName=leafName.upper()
180 if leafName
not in self.TagAndNodeVersionDict:
184 return dbId,dbContent,paramName
188 leafTagId=self.TagAndNodeVersionDict[leafName][1]
190 query = self.dbSchema.tableHandle(upLeafName+
"_DATA2TAG").newQuery()
191 query.addToOutputList(upLeafName+
'_DATA_ID')
193 bindstag2node = coral.AttributeList()
194 condString=upLeafName+
'_TAG_ID='+
str(leafTagId)
195 query.setCondition(condString,bindstag2node)
197 dictRes,typeList=self.AnalyseDBRequestOutput_Query(query)
198 dataIdList=[
int(s[upLeafName+
'_DATA_ID'])
for s
in dictRes]
203 query = self.dbSchema.tableHandle(upLeafName+
"_DATA").newQuery()
205 condString=upLeafName+
'_DATA_ID IN ('+
str(dataIdList)[1:-1]+
") ORDER BY "+upLeafName+
"_DATA_ID"
206 query.setCondition(condString,bindstag2node)
208 dictRes,typeList=self.AnalyseDBRequestOutput_Query(query)
216 paramName=[s[0]
for s
in typeList]
218 paramKey=typeList[0][0]
224 v=[s[k[0]]
for k
in typeList]
227 return dbId,dbContent,paramName
◆ ReadGeometryTagId()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.ReadGeometryTagId |
( |
|
self | ) |
|
Read the geometry Id corresponding to the geometry tag name in order to collect the child node Id's
Definition at line 58 of file AtlasGeoDBInterface.py.
58 def ReadGeometryTagId(self):
59 """ Read the geometry Id corresponding to the geometry tag name in order to collect the child node Id's """
61 query = self.dbSchema.tableHandle(
"HVS_TAG2NODE").newQuery()
63 query.addToOutputList(
'TAG_NAME')
64 query.addToOutputList(
'TAG_ID')
66 bindstag2node = coral.AttributeList()
67 bindstag2node.extend(
'tagN',
'string')
68 bindstag2node[0].setData(self.dbGeoTag)
69 condString=
'TAG_NAME=:tagN'
71 query.setCondition(condString,bindstag2node)
73 for currentRow
in iter(query.execute()):
74 for i
in range(0,currentRow.size()):
75 if currentRow[i].specification().
name()==
"TAG_ID":
76 Logging.log.verbose(
"*** GeoTagId ******** "+
str(currentRow))
77 self.dbGeoTagId=currentRow[i].
data()
◆ ReadTagAndNodeVersionsFromDB()
def python.AtlasGeoDBInterface.AtlasGeoDBInterface.ReadTagAndNodeVersionsFromDB |
( |
|
self | ) |
|
Read tag and node versions defined for the geometry tag
Definition at line 119 of file AtlasGeoDBInterface.py.
119 def ReadTagAndNodeVersionsFromDB(self):
120 """ Read tag and node versions defined for the geometry tag """
128 if self.dbGeoTagId==
"":
129 Logging.log.error(
"The geometry tag %s could not be found in the database.", self.dbGeoTag)
130 Logging.log.error(
"Its name might be misspelled and/or the script might access a local DB that is not up to date.")
135 tagIdList=[
int(self.dbGeoTagId)]
138 while not bStopLoop :
140 query0 = self.dbSchema.newQuery()
142 query0.addToOutputList(
'C.NODE_NAME',
"nodename")
143 query0.addToOutputList(
'A.TAG_NAME',
"tagname")
144 query0.addToOutputList(
'A.TAG_ID',
"tagid")
146 query0.addToTableList(
"HVS_TAG2NODE",
"A" )
147 query0.addToTableList(
"HVS_LTAG2LTAG",
"B")
148 query0.addToTableList(
"HVS_NODE",
"C" )
150 bindstag2node = coral.AttributeList()
151 condString=
"C.NODE_ID=A.NODE_ID AND A.TAG_ID=B.CHILD_TAG and B.PARENT_TAG IN (%s)" %
str(tagIdList)[1:-1]
152 Logging.log.verbose(
"----------------------------\n"+condString)
153 query0.setCondition(condString,bindstag2node)
156 dictRes,paramType=self.AnalyseDBRequestOutput_Query(query0,
"nodename")
157 tagDictGbl.update(dictRes)
160 if len(dictRes.keys())==0:
165 tagIdList=[
int(dictRes[k][1])
for k
in dictRes.keys()]
168 self.TagAndNodeVersionDict.
update(tagDictGbl)
◆ bVerbose
python.AtlasGeoDBInterface.AtlasGeoDBInterface.bVerbose |
◆ dbGeoTag
python.AtlasGeoDBInterface.AtlasGeoDBInterface.dbGeoTag |
◆ dbGeoTagId
python.AtlasGeoDBInterface.AtlasGeoDBInterface.dbGeoTagId |
◆ dbSchema
python.AtlasGeoDBInterface.AtlasGeoDBInterface.dbSchema |
◆ dbSession
python.AtlasGeoDBInterface.AtlasGeoDBInterface.dbSession |
◆ TagAndNodeVersionDict
python.AtlasGeoDBInterface.AtlasGeoDBInterface.TagAndNodeVersionDict |
The documentation for this class was generated from the following file: