ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite Class Reference
Collaboration diagram for python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite:

Public Member Functions

def __init__ (self, geoTag, sqliteDBFullPath, verbose=False)
 
def ConnectToDB (self)
 
def GetData (self, tableName)
 

Public Attributes

 db
 
 bVerbose
 
 dbFile
 

Detailed Description

Definition at line 235 of file AtlasGeoDBInterface.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.__init__ (   self,
  geoTag,
  sqliteDBFullPath,
  verbose = False 
)

Definition at line 237 of file AtlasGeoDBInterface.py.

237  def __init__(self,geoTag,sqliteDBFullPath,verbose=False):
238 
239  self.db=None
240  self.bVerbose=verbose
241 
242  if sqliteDBFullPath:
243  self.dbFile=sqliteDBFullPath
244  else:
245  from AthenaCommon.Utils.unixtools import find_datafile
246  pathlist = os.getenv('CALIBPATH').split(os.pathsep)
247  self.dbFile=find_datafile("Geometry/"+geoTag+".db",pathlist)
248 

Member Function Documentation

◆ ConnectToDB()

def python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.ConnectToDB (   self)

Definition at line 249 of file AtlasGeoDBInterface.py.

249  def ConnectToDB(self):
250 
251  try:
252  self.db=sqlite3.connect(self.dbFile)
253  except Exception as e:
254  Logging.log.fatal(f'Failed to open SQLite database {self.dbFile}. {e}')
255  Logging.log.debug(f'Connected to SQLite database {self.dbFile}')
256 

◆ GetData()

def python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.GetData (   self,
  tableName 
)

Definition at line 257 of file AtlasGeoDBInterface.py.

257  def GetData(self,tableName):
258 
259  # Check the existence of the table in the DB
260  cur = self.db.cursor()
261  querystring = "SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name='"+tableName+"'"
262  cur.execute(querystring)
263  checkTable = cur.fetchall()
264  if len(checkTable)==0:
265  Logging.log.info(f'Table {tableName} not found in the SQLite DB. Falling back on the default config')
266  return []
267 
268  # Fetch the data
269  cur = self.db.cursor()
270  querystring = "SELECT * FROM "+tableName+" order by "+tableName+"_data_id"
271  cur.execute(querystring)
272  rows = cur.fetchall()
273 
274  ncols=len(cur.description)
275  dbData=[]
276  for row in rows:
277  dbDataRow={}
278  for i in range(1,ncols):
279  dbDataRow[cur.description[i][0]]=row[i]
280  Logging.log.debug(f'Fetched Data Row for {tableName}')
281  Logging.log.debug(f'{dbDataRow}')
282  dbData.append(dbDataRow)
283 
284  return dbData

Member Data Documentation

◆ bVerbose

python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.bVerbose

Definition at line 240 of file AtlasGeoDBInterface.py.

◆ db

python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.db

Definition at line 239 of file AtlasGeoDBInterface.py.

◆ dbFile

python.AtlasGeoDBInterface.AtlasGeoDBInterface_SQLite.dbFile

Definition at line 243 of file AtlasGeoDBInterface.py.


The documentation for this class was generated from the following file:
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
query_example.cursor
cursor
Definition: query_example.py:21
python.Utils.unixtools.find_datafile
def find_datafile(fname, pathlist=None, access=os.R_OK)
pathresolver-like helper function --------------------------------------—
Definition: unixtools.py:67
Trk::split
@ split
Definition: LayerMaterialProperties.h:38