Files
edx-platform/common/djangoapps/util/query.py
Kyle McCormick ea5652010c Create Python API for program_enrollments: Part I (#21511)
This is the first in a series of commits to create
a Python API for the LMS program_enrollments app.
We do some general refactoring, renaming, and clean-up
in order to move toward the creation of that API.

EDUCATOR-4321
2019-09-04 14:06:00 -04:00

13 lines
386 B
Python

""" Utility functions related to database queries """
from __future__ import absolute_import
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 / manager.
"""
return queryset.using("read_replica") if "read_replica" in settings.DATABASES else queryset