1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

[soc2009/multidb] Added the start of documentation for multidb

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2009-06-26 18:16:18 +00:00
parent 1b183216ec
commit 7838fd87eb

View File

@ -874,6 +874,24 @@ logically::
# existing set of fields). # existing set of fields).
Entry.objects.defer("body").only("headline", "body") Entry.objects.defer("body").only("headline", "body")
``using(alias)``
~~~~~~~~~~~~~~~~~~
.. versionadded:: 1.2
This method is for controlling which database the ``QuerySet`` will be
evaluated against if you are using more than one database. The only argument
this method takes is the alias of a database, as defined in
:settings:`DATABASES`.
For example::
# queries the database with the 'default' alias.
>>> Entry.objects.all()
# queries the database with the 'backup' alias
>>> Entry.objects.using('backup')
QuerySet methods that do not return QuerySets QuerySet methods that do not return QuerySets
--------------------------------------------- ---------------------------------------------