Files
edx-platform/common/djangoapps/util/query.py
2014-11-10 10:59:44 -08:00

10 lines
332 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