本文整理匯總了Python中DIRAC.ResourceStatusSystem.Utilities.MySQLWrapper.insert方法的典型用法代碼示例。如果您正苦於以下問題:Python MySQLWrapper.insert方法的具體用法?Python MySQLWrapper.insert怎麽用?Python MySQLWrapper.insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.ResourceStatusSystem.Utilities.MySQLWrapper
的用法示例。
在下文中一共展示了MySQLWrapper.insert方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: insert
# 需要導入模塊: from DIRAC.ResourceStatusSystem.Utilities import MySQLWrapper [as 別名]
# 或者: from DIRAC.ResourceStatusSystem.Utilities.MySQLWrapper import insert [as 別名]
def insert( self, params, meta ):
'''
Inserts args in the DB making use of kwargs where parameters such as
the 'table' are specified ( filled automatically by the Client). Typically you
will not pass kwargs to this function, unless you know what are you doing
and you have a very special use case.
:Parameters:
**params** - `dict`
arguments for the mysql query ( must match table columns ! ).
**meta** - `dict`
metadata for the mysql query. It must contain, at least, `table` key
with the proper table name.
:return: S_OK() || S_ERROR()
'''
utcnow = datetime.utcnow().replace( microsecond = 0 )
# We force lastCheckTime to utcnow if it is not present on the params
#if not( 'lastCheckTime' in params and not( params[ 'lastCheckTime' ] is None ) ):
if 'lastCheckTime' in params and params[ 'lastCheckTime' ] is None:
params[ 'lastCheckTime' ] = utcnow
if 'dateEffective' in params and params[ 'dateEffective' ] is None:
params[ 'dateEffective' ] = utcnow
return MySQLWrapper.insert( self, params, meta )