UserProfileDB
UserProfileDB class is a front-end to the User Profile Database
- class DIRAC.FrameworkSystem.DB.UserProfileDB.UserProfileDB(parentLogger=None)
Bases:
DB
UserProfileDB class is a front-end to the User Profile Database
- __init__(parentLogger=None)
Constructor
- buildCondition(condDict=None, older=None, newer=None, timeStamp=None, orderAttribute=None, limit=False, greater=None, smaller=None, offset=None, useLikeQuery=False)
Build SQL condition statement from provided condDict and other extra check on a specified time stamp. The conditions dictionary specifies for each attribute one or a List of possible values greater and smaller are dictionaries in which the keys are the names of the fields, that are requested to be >= or < than the corresponding value. For compatibility with current usage it uses Exceptions to exit in case of invalid arguments For performing LIKE queries use the parameter useLikeQuery=True
- countEntries(table, condDict, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)
Count the number of entries wit the given conditions
- deleteEntries(tableName, condDict=None, limit=False, conn=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None)
Delete rows from “tableName” with N records can match the condition if limit is not False, the given limit is set String type values will be appropriately escaped, they can be single values or lists of values.
- deleteUserProfile(userName, userGroup=False)
Delete the profiles for a user
- deleteVar(userName, userGroup, profileName, varName)
Helper for deleting data
- deleteVarByUserId(userIds, profileName, varName)
Remove a data entry for a profile
- executeStoredProcedure(packageName, parameters, outputIds, *, conn=None)
- executeStoredProcedureWithCursor(packageName, parameters, *, conn=None)
- getCSOption(optionName, defaultValue=None)
- getCounters(table, attrList, condDict, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)
Count the number of records on each distinct combination of AttrList, selected with condition defined by condDict and time stamps
- getDistinctAttributeValues(table, attribute, condDict=None, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)
Get distinct values of a table attribute under specified conditions
- getFields(tableName, outFields=None, condDict=None, limit=False, conn=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None, useLikeQuery=False)
Select “outFields” from “tableName” with condDict N records can match the condition return S_OK(tuple(Field, Value)) if outFields is None all fields in “tableName” are returned if limit is not False, the given limit is set inValues are properly escaped using the _escape_string method, they can be single values or lists of values. if useLikeQuery=True, then conDict can return matched rows if “%” is defined inside conDict.
- getUserGroupIds(userName, userGroup, insertIfMissing=True)
- getUserProfileNames(permission)
it returns the available profile names by not taking account the permission: ReadAccess and PublishAccess
- insertFields(tableName, inFields=None, inValues=None, conn=None, inDict=None)
Insert a new row in “tableName” assigning the values “inValues” to the fields “inFields”. String type values will be appropriately escaped.
- listVars(userName, userGroup, profileName, filterDict=None)
- listVarsById(userIds, profileName, filterDict=None)
- retrieveAllUserVars(userName, userGroup, profileName)
Helper for getting data
- retrieveAllUserVarsById(userIds, profileName)
Get a data entry for a profile
- retrieveUserProfiles(userName, userGroup)
Helper for getting data
- retrieveUserProfilesById(userIds)
Get all profiles and data for a user
- retrieveVar(userName, userGroup, ownerName, ownerGroup, profileName, varName)
Get a data entry for a profile
- retrieveVarById(userIds, ownerIds, profileName, varName)
Get a data entry for a profile
- retrieveVarPerms(userName, userGroup, ownerName, ownerGroup, profileName, varName)
- retrieveVarPermsById(userIds, ownerIds, profileName, varName)
Get a data entry for a profile
- setUserVarPerms(userName, userGroup, profileName, varName, perms)
- setUserVarPermsById(userIds, profileName, varName, perms)
- storeVar(userName, userGroup, profileName, varName, data, perms=None)
Helper for setting data
- storeVarByUserId(userIds, profileName, varName, data, perms)
Set a data entry for a profile
- tableDict = {'up_Groups': {'Engine': 'InnoDB', 'Fields': {'Id': 'INTEGER AUTO_INCREMENT NOT NULL', 'LastAccess': 'DATETIME', 'UserGroup': 'VARCHAR(32) NOT NULL'}, 'PrimaryKey': 'Id', 'UniqueIndexes': {'G': ['UserGroup']}}, 'up_ProfilesData': {'Engine': 'InnoDB', 'Fields': {'Data': 'TEXT', 'GroupId': 'INTEGER', 'Profile': 'VARCHAR(255) NOT NULL', 'PublishAccess': 'VARCHAR(10) DEFAULT "USER"', 'ReadAccess': 'VARCHAR(10) DEFAULT "USER"', 'UserId': 'INTEGER', 'VOId': 'INTEGER', 'VarName': 'VARCHAR(255) NOT NULL'}, 'Indexes': {'ProfileKey': ['UserId', 'GroupId', 'Profile'], 'UserKey': ['UserId']}, 'PrimaryKey': ['UserId', 'GroupId', 'Profile', 'VarName']}, 'up_Users': {'Engine': 'InnoDB', 'Fields': {'Id': 'INTEGER AUTO_INCREMENT NOT NULL', 'LastAccess': 'DATETIME', 'UserName': 'VARCHAR(64) NOT NULL'}, 'PrimaryKey': 'Id', 'UniqueIndexes': {'U': ['UserName']}}, 'up_VOs': {'Engine': 'InnoDB', 'Fields': {'Id': 'INTEGER AUTO_INCREMENT NOT NULL', 'LastAccess': 'DATETIME', 'VO': 'VARCHAR(32) NOT NULL'}, 'PrimaryKey': 'Id', 'UniqueIndexes': {'VO': ['VO']}}}
- transactionCommit()
- transactionRollback()
- transactionStart()
- updateFields(tableName, updateFields=None, updateValues=None, condDict=None, limit=False, conn=None, updateDict=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None)
Update “updateFields” from “tableName” with “updateValues”. updateDict alternative way to provide the updateFields and updateValues N records can match the condition return S_OK( number of updated rows ) if limit is not False, the given limit is set String type values will be appropriately escaped.