Files
edx-platform/common/djangoapps/util/query.py
Julia Hansbrough ea0ae11171 Response to CR 1-14
2014-01-15 00:27:14 +00:00

9 lines
331 B
Python

""" Utility functions related to database queries """
from django.conf import settings
def use_read_replica_if_available(queryset):
"""
If there is a database called 'read_replica', use that database for the queryset.
"""
return queryset.using("read_replica") if "read_replica" in settings.DATABASES else queryset