Attempt to load using a specified condition, but will not fail if such record is not found
964496
public function tryLoadBy($field, $cond = UNDEFINED, $value = UNDEFINED)
    {
        $q = $this->dsql;
        $this->dsql = $this->dsql();
        $this->addCondition($field, $cond, $value);
        $this->tryLoadAny();
        $this->dsql = $q;

        return $this;
    }
1131711
async function loadRecordAndRelation (controller, args) {
    // if no id is passed throw error
    if (!defined(args.id)) {
        httpError(404)
    }
    // if no relationId is set throw error
    if (!defined(args.relationId)) {
        httpError(400, 'relationId required')
    }
    // get primary model from controller
    var primaryModel = controller.model
    // get relation
    var relation = primaryModel.relation(args.relation)
    // throw error on invalid relation
    if (!defined(relation)) {
        httpError(400, `invalid relation ${args.relation}`)
    }
    // get related model
    var relatedModel = relation.model
    // build common query args for both queries
    var queryArgs = {
        limit: 1,
        session: args.session,
    }
    // add current flag if set
    if (args.current) {
        queryArgs.current = true
    }
    // query both deleted and not deleted instances if deleted option set
    if (args.deleted) {
        queryArgs.where.isDeleted = null
    }
    // build args for primary record query
    var primaryQueryArgs = _.clone(queryArgs)
    primaryQueryArgs.where = {id: args.id}
    // get args for related 
    var relatedQueryArgs = _.clone(queryArgs)
    relatedQueryArgs.where = {id: args.relationId}
    // load records
    var [primaryRecord, relatedRecord] = await Promise.all([
        primaryModel.query(primaryQueryArgs),
        relatedModel.query(relatedQueryArgs),
    ])
    // throw error if primary record not found
    if (!defined(primaryRecord)) {
        httpError(404)
    }
    // throw error if related record not found
    if (!defined(relatedModel)) {
        httpError(400, `related record ${args.relation}#${args.relationId} not found`)
    }
    // create new object that will be merged into args
    var merge = {}
    // add records to return data
    merge[primaryModel.name] = primaryRecord
    merge[relatedModel.name] = relatedRecord
    // return data to merge into args
    return merge
}
248594
def get_record(uid=None):
    
    obj = None
    if uid is not None:
        obj = get_object_by_uid(uid)
    else:
        obj = get_object_by_request()
    if obj is None:
        fail(404, "No object found")
    complete = req.get_complete(default=_marker)
    if complete is _marker:
        complete = True
    items = make_items_for([obj], complete=complete)
    return u.first(items)
973636
def _loadColumns(self, record, columnName, value):
        
        value = unwrapNone(value)
        item = self.findRecordItem(record)
        if item:
            item.updateColumnValue(record.schema().column(columnName),
                                   value,
                                   self.column(columnName))
878622
def exists(self, record_key):
        
        ''' 
            
        '''
        
        title = '%s.exists' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # send get metadata request
        file_path = '/%s' % record_key
        try:
            self.dropbox.files_get_metadata(file_path)
        except Exception as err:
            if str(err).find("LookupError('not_found'") > -1:
                return False
            else:
                raise DropboxConnectionError(title)

        return True
1197099
function findRecord(store, fieldName, text) {
      var index = store.find(fieldName, text);
      if (index === -1) {
        throw new Error('Text: ' + text + ' not found for fieldName: ' + fieldName);
      }
      return index;
    }
1140027
def exists(self, record_key):
        
        ''' 
            
        '''
        
        title = '%s.exists' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # read record headers
        record_status = self.s3.read_headers(self.bucket_name, record_key)
        if record_status:
            return True
        return False
1028167
def load(self, record_key, secret_key=''):

        ''' 
            
        '''

        title = '%s.load' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # verify permissions
        if not self.permissions_content:
            raise Exception('%s requires an access_token with file content permissions.' % title)
            
    # retrieve file id
        file_id, parent_id = self._get_id(record_key)
        if not file_id:
            raise Exception('%s(record_key=%s) does not exist.' % (title, record_key))
    
    # request file data
        try:
            record_data = self.drive.get_media(fileId=file_id).execute()
        except:
            raise DriveConnectionError(title)
    
    # retrieve data from response
    #     import io
    #     from googleapiclient.http import MediaIoBaseDownload
    #     file_header = io.BytesIO
    #     record_data = MediaIoBaseDownload(file_header, response)
    #     done = False
    #     while not done:
    #         status, done = record_data.next_chunk()
    
    # TODO export google document to other format
            
    # decrypt (if necessary)
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
    
        return record_data
997583
def filter(self, record):
        """"""
        if g and hasattr(g, 'request_id'):
            record.request_id = g.request_id
        return True
745765
def __get_handle_record_if_necessary(self, handle, handlerecord_json):
        '''
        

        '''
        if handlerecord_json is None:
            handlerecord_json = self.retrieve_handle_record_json(handle)
        else:
            if handle != handlerecord_json['handle']:
                handlerecord_json = self.retrieve_handle_record_json(handle)
        return handlerecord_json
908785
function() {
			if( this.dsRecord && this.dsRecord.isReady && Object.keys( this.dsRecord.get() ).length === 0 && this.state ) {
				this.dsRecord.set( this.state );
			}
		}
25817
def load(cls, rr, pk):
        '''
        
        '''
        if pk is None:
            return None
        d = rr.table(cls.table).get(pk).run()
        if d is None:
            return None
        doc = cls(rr, d)
        return doc
774183
def loadBatch(self, records):
        
        try:
            curr_batch = records[:self.batchSize()]
            next_batch = records[self.batchSize():]
            
            curr_records = list(curr_batch)
            if self._preloadColumns:
                for record in curr_records:
                    record.recordValues(self._preloadColumns)
            
            if len(curr_records) == self.batchSize():
                self.loadedRecords[object, object].emit(curr_records,
                                                        next_batch)
            else:
                self.loadedRecords[object].emit(curr_records)
        
        except ConnectionLostError:
            self.connectionLost.emit()
        
        except Interruption:
            pass
392742
def exists(self, record_key):
        
        ''' 
            
        '''
        
        title = '%s.exists' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # construct request kwargs
        list_kwargs = {
            'spaces': self.drive_space,
            'fields': 'files(id)'
        }
    
    # retrieve file id
        file_id, parent_id = self._get_id(record_key)
        if file_id:
            return True
        return False
1268624
function onStorageResponse (
  error, record, recordName, socketWrapper, onComplete, onError, options, context, metaData
) {
  if (error) {
    sendError(
      C.EVENT.RECORD_LOAD_ERROR,
      `error while loading ${recordName} from storage:${error.toString()}`,
      recordName,
      socketWrapper,
      onError,
      options,
      context,
      metaData
    )
  } else {
    onComplete.call(context, record || null, recordName, socketWrapper)

    if (record) {
      options.cache.set(recordName, record, () => {}, metaData)
    }
  }
}
340104
def load(self, **kwargs):
        """"""
        if 'name' in kwargs:
            if 'ldns' not in kwargs['name'] or 'server' not in kwargs['name']:
                raise InvalidName("Topology record name should contain both "
                                  "'ldns', 'server' keywords with their "
                                  "proper arguments")
        kwargs['transform_name'] = True

        return self._load(**kwargs)
201365
def _init_record(self, record_type_idstr):
        """"""
        record_type_data = self._all_supported_record_type_data_sets[Id(record_type_idstr).get_identifier()]
        module = importlib.import_module(record_type_data['module_path'])
        record = getattr(module, record_type_data['query_record_class_name'])
        self._records[record_type_idstr] = record(self)