ResourceManagementDB

ResourceManagementDB: This module provides definition of the DB tables, and methods to access them.

Written using sqlalchemy declarative_base

For extending the ResourceStatusDB tables:

  1. In the extended module, call:

from DIRAC.ResourceStatusSystem.DB.ResourceManagementDB import rmsBase, TABLESLIST TABLESLIST = TABLESLIST + [list of new table names]

  1. provide a declarative_base definition of the tables (new or extended) in the extension module
class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.ResourceManagementDB

Bases: object

Class that defines the methods to interact to the ResourceManagementDB tables

__init__()

c’tor

Parameters:self – self reference
addOrModify(table, params)

Using the PrimaryKeys of the table, it looks for the record in the database. If it is there, it is updated, if not, it is inserted as a new entry.

Parameters:
  • table (str) – table where to add or modify
  • params (dict) – dictionary of what to add or modify
Returns:

S_OK() || S_ERROR()

delete(table, params)
Parameters:
  • table (str) – table from where to delete
  • params (dict) – dictionary of which line(s) to delete
Returns:

S_OK() || S_ERROR()

insert(table, params)

Inserts params in the DB.

Parameters:
  • table (str) – table where to insert
  • params (dict) – Dictionary to fill a single line
Returns:

S_OK() || S_ERROR()

select(table, params)

Uses params to build conditional SQL statement ( WHERE … ).

Parameters:
params - dict

arguments for the mysql query ( must match table columns ! ).

Returns:

S_OK() || S_ERROR()