Returns an instance matching the primary key provided. ``None``  is
        returned if no match is found (or the object_id failed validation
        against the primary key field).
500952
def get_object(self, request, object_id):
        
        queryset = self.queryset(request)
        model = queryset.model
        try:
            object_id = model._meta.pk.to_python(object_id)
            return queryset.get(pk=object_id)
        except (model.DoesNotExist, ValidationError):
            return None
945260
def get_object(table, id=None, condition=None, cache=False, fields=None, use_local=False,
               engine_name=None, session=None):
    
    from uliweb import functions, settings
    
    model = get_model(table, engine_name)
        
    #if id is an object of Model, so get the real id value
    if isinstance(id, Model):
        return id
      
    if cache:
        if use_local:
            s = get_session(session)
            key = get_object_id(s.engine_name, model.tablename, id)
            value = s.get_local_cache(key)
            if value:
                return value
        obj = model.get(id, condition=condition, fields=fields, cache=True)
        if use_local:
            value = s.get_local_cache(key, obj)
    else:
        obj = model.get(id, condition=condition, fields=fields)
    
    return obj
521427
def find_model_by_id(self, constructor, id_, *, columns=None):
    
    return self.find_model(
      constructor, get_id_constraints(constructor.primary_key_name, id_), columns=columns)
1197987
def get_instance(self, payload):
        
        return KeyInstance(self._version, payload, account_sid=self._solution['account_sid'], )
506110
def get_object(self, view_kwargs, qs=None):
        
        self.before_get_object(view_kwargs)

        id_field = getattr(self, 'id_field', inspect(self.model).primary_key[0].key)
        try:
            filter_field = getattr(self.model, id_field)
        except Exception:
            raise Exception("{} has no attribute {}".format(self.model.__name__, id_field))

        url_field = getattr(self, 'url_field', 'id')
        filter_value = view_kwargs[url_field]

        query = self.retrieve_object_query(view_kwargs, filter_field, filter_value)

        if qs is not None:
            query = self.eagerload_includes(query, qs)

        try:
            obj = query.one()
        except NoResultFound:
            obj = None

        self.after_get_object(obj, view_kwargs)

        return obj
745038
def get_for_object(self, instance):
        
        # Return empty queryset if the given model instance is not a model instance.
        if not isinstance(instance, models.Model):
            return self.none()

        content_type = ContentType.objects.get_for_model(instance.__class__)
        pk = self._get_pk_value(instance)

        if isinstance(pk, integer_types):
            return self.filter(content_type=content_type, object_id=pk)
        else:
            return self.filter(content_type=content_type, object_pk=smart_text(pk))
104775
def exists(self, value=None):
        
        try:
            if not value:
                value = self.get()
        except (AttributeError, DoesNotExist):
            # If the instance is deleted, the _pk attribute doesn't exist
            # anymore. So we catch the AttributeError to return False (this pk
            # field doesn't exist anymore) in this specific case
            return False
        else:
            return self.connection.sismember(self.collection_key, value)
780640
def get_one(self, object_id):
        
        return self.session.query(self.cls).filter_by(id=object_id).one()
179780
def get(self, key, default=None, type_=None):
        
        try:
            rv = self[key]
        except KeyError:
            return default
        if type_ is not None:
            try:
                rv = type_(rv)
            except ValueError:
                rv = default
        return rv
23189
def find_or_new(self, id, columns=None):
        
        if columns is None:
            columns = ['*']

        instance = self.find(id, columns)

        if instance is None:
            instance = self._related.new_instance()
            self._set_foreign_attributes_for_create(instance)

        return instance
565844
def get_instance(self, payload):
        
        return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], )
264933
def get_model_id_constraints(model):
  """"""
  pkname = model.primary_key_name
  pkey = model.primary_key
  return get_id_constraints(pkname, pkey)
1087235
function matchPrimaryKeys(model) {
    return model.primaryKeyAttributes.map(
        function(name) { return util.format('%s = NEW.%s', name, name)})
        .join(' AND ');
  }
437337
def id_field_name(cls):
        
        if cls._cache_id_field_name is None:
            pk_names = cls.pk_names()
            if len(pk_names) == 1:
                cls._cache_id_field_name = pk_names[0]
            else:  # pragma: no cover
                raise ValueError(
                    "{classname} has more than 1 primary key!"
                    .format(classname=cls.__name__)
                )
        return cls._cache_id_field_name
174015
def _get_pk_value(self, instance):
        
        pk_field = instance._meta.pk.name
        pk = getattr(instance, pk_field, None)

        # Check to make sure that we got an pk not a model object.
        if isinstance(pk, models.Model):
            pk = self._get_pk_value(pk)
        return pk
1274213
def get_one(self, key):
        
        query = build_db_query(self.primary_key, key)
        collection = self.ds.connection(self.collection_name)

        document = collection.find_one(query)
        if document is None:
            raise LookupError('{0} with key {1} was not found'.format(self.model_klass.__name__, query))
        return self.model_klass.from_json(document)
450683
def get(self, key, default=None, cast=True):
        
        tablename, _, key = key.rpartition(':')
        if tablename and tablename not in self.fields.name.split('+'):
            raise ItsdbError('column requested from wrong table: {}'
                             .format(tablename))
        try:
            index = self.fields.index(key)
            value = list.__getitem__(self, index)
        except (KeyError, IndexError):
            value = default
        else:
            if cast:
                field = self.fields[index]
                value = _cast_to_datatype(value, field)
        return value