(self, request: HttpRequest)
return HttpResponse("OK")
Connect to each database and do a generic standard SQL query
        that doesn't write any data and doesn't depend on any tables
        being present.
Connect to each database and do a generic standard SQL query
        that doesn't write any data and doesn't depend on any tables
        being present.
Connect to each database and do a generic standard SQL query that doesn t write any data and doesn t depend on any tables being present .
def readiness(self, request: HttpRequest) -> HttpResponse:
        """
        Connect to each database and do a generic standard SQL query
        that doesn't write any data and doesn't depend on any tables
        being present.
        """
        try:
            from django.db import connections  # pylint: disable=import-outside-toplevel

            for name in connections:
                cursor = connections[name].cursor()
                cursor.execute("SELECT 1;")
                row = cursor.fetchone()
                if row is None:
                    return HttpResponseServerError(ReadinessError.PG_BAD_RESPONSE)
        except Exception:  # noqa: PIE786
            logger.exception("could not connect to postgres")
            return HttpResponseServerError(ReadinessError.PG_CANNOT_CONNECT)

        return HttpResponse("OK")
def readiness ( self , request : HttpRequest ) -> HttpResponse : try : from django . db import connections # pylint: disable=import-outside-toplevel for name in connections : cursor = connections [ name ] . cursor ( ) cursor . execute ( "SELECT 1;" ) row = cursor . fetchone ( ) if row is None : return HttpResponseServerError ( ReadinessError . PG_BAD_RESPONSE ) except Exception : # noqa: PIE786 logger . exception ( "could not connect to postgres" ) return HttpResponseServerError ( ReadinessError . PG_CANNOT_CONNECT ) return HttpResponse ( "OK" )