Selects which database this QuerySet should excecute its query against.
192730
def using(self, alias):
        
        clone = self._clone()
        clone._index = alias
        return clone
69909
def find(self, *args, **kwargs):
    " "
    return Query(*args, db=self, schema=self.schema)
760218
def list(self, cls, criteria=None):
        
        self.validate_criteria(cls, criteria)
        return self.db.select(cls, where=criteria)
725233
def queryset(self, request, queryset):
        
        if self.value():
            return queryset.filter(country=self.value())
        else:
            return queryset
147080
def _query(self, *criterion):
        
        return self.session.query(
            self.model_class
        ).filter(
            *criterion
        )
1165055
def select_node(**kw):
    
    with current_app.app_context():
        result = db.execute(text(fetch_query_string('select_node_from_id.sql')), **kw).fetchall()
        return result
266320
def default_database(ctx: click.Context, _param: Parameter, value: Optional[str]):
    """"""
    if value:
        return value

    if ctx.params["repository"]:
        return os.path.join(ctx.params["repository"], DB.DEFAULT_DB_FILE)

    raise click.BadParameter("Could not guess a database location")
1247366
public function select_database($database)
    {
        //        try{

        if ($this->pdo) {
            if ($this->pdo->exec('USE ' . $database) !== FALSE) {
                return true;
            }
        }
        //        }catch(\Exception $ex)
        //        {
        //            new Exception($this->getLastError());
        //        }
        return false;
    }
72563
public String select(int databaseIndex) {
		Jedis jedis = getJedis();
		try {
			return jedis.select(databaseIndex);
		}
		finally {close(jedis);}
	}
239173
def filter(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=False, *args, **kwargs)
713820
def select(query, data=None):
    
    connection = _State.connection()
    _State.new_transaction()
    if data is None:
        data = []

    result = connection.execute('select ' + query, data)

    rows = []
    for row in result:
        rows.append(dict(list(row.items())))

    return rows
998999
def get(self, *args, **kwargs):
        
        if self.query.where:
            # If there is any other ``where`` filter on this QuerySet just call
            # super. There will be a where clause if this QuerySet has already
            # been filtered/cloned.
            return super(CachingQuerySet, self).get(*args, **kwargs)
 
        # Punt on anything more complicated than get by pk/id only...
        if len(kwargs) == 1:
            k = kwargs.keys()[0]
            if k in ('pk', 'pk__exact', '%s' % self.model._meta.pk.attname, 
                     '%s__exact' % self.model._meta.pk.attname):
                obj = cache.get(self.model._cache_key(pk=kwargs.values()[0]))
                if obj is not None:
                    obj.from_cache = True
                    return obj
 
        # Calls self.iterator to fetch objects, storing object in cache.
        return super(CachingQuerySet, self).get(*args, **kwargs)
273695
def _get_database(self, database_name):
        
        try:
            return self._client[database_name]
        except InvalidName as ex:
            raise DataSourceError("Cannot connect to database %s!"
                                  % self._database) from ex
558100
def get_queryset(self, request):
        
        if request.GET.get(ShowHistoryFilter.parameter_name) == '1':
            queryset = self.model.objects.with_active_flag()
        else:
            # Show only the most recent row for each key.
            queryset = self.model.objects.current_set()
        ordering = self.get_ordering(request)
        if ordering:
            return queryset.order_by(*ordering)
        return queryset
767447
def select(self, db):
        """"""
        if not isinstance(db, int):
            raise TypeError("DB must be of int type, not {!r}".format(db))
        if db < 0:
            raise ValueError("DB must be greater or equal 0, got {!r}"
                             .format(db))
        fut = self.execute('SELECT', db)
        return wait_ok(fut)
784026
def filter(self, **kwargs):
        """"""
        assert not self._primary_keys
        self.queryset = self.queryset.filter(**kwargs)
        return self
699972
def query(self, force=False):
        """"""
        if not self.is_valid():
            raise forms.ValidationError(self.errors)
        if force:
            self._is_selected = False
        if not self._is_selected:
            if self.queryset is None:
                raise TypeError('Must be QuerySet not %s' %
                                type(self.queryset))
            self.select()
            self._is_selected = True
        return self.queryset