From 8c70cf811bf2a253d0fbe0a589fadf183ab4cb7c Mon Sep 17 00:00:00 2001 From: Antoine Mineau Date: Thu, 1 Apr 2021 17:56:32 +0200 Subject: [PATCH] add 'SELECT 1' to check if db is really alive --- django_replicated/dbchecker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_replicated/dbchecker.py b/django_replicated/dbchecker.py index 5d8ce72..50a3411 100644 --- a/django_replicated/dbchecker.py +++ b/django_replicated/dbchecker.py @@ -40,8 +40,8 @@ def is_alive(connection): connection.connection.ping() else: log.debug('Get cursor for db: %s', connection.alias) - with connection.cursor(): - pass + with connection.cursor() as cur: + cur.execute("SELECT 1") return True