@db_api.retry_if_session_inactive()
def get_quota_usage_by_resource_and_tenant(context, resource, tenant_id, lock_for_update=False):
 query = db_utils.model_query(context, quota_models.QuotaUsage)
 query = query.filter_by(resource=resource, tenant_id=tenant_id)
 if lock_for_update:
  query = query.with_lockmode('update')
 result = query.first()
 if (not result):
  return
 return QuotaUsageInfo(result.resource, result.tenant_id, result.in_use, result.dirty)

@ db_api . retry_if_session_inactive ( ) def get_quota_usage_by_resource_and_tenant ( context , resource , tenant_id , lock_for_update = False ) : query = db_utils . model_query ( context , quota_models . QuotaUsage ) query = query . filter_by ( resource = resource , tenant_id = tenant_id ) if lock_for_update : query = query . with_lockmode ( 'update' ) result = query . first ( ) if ( not result ) : return return QuotaUsageInfo ( result . resource , result . tenant_id , result . in_use , result . dirty )
return usage info for a given resource and tenant .