Skip to content

Commit

Permalink
Test query database compatibility
Browse files Browse the repository at this point in the history
Use 'SELECT 1', it's the more compatible. This works on most commonly
used databases, like postgreSQL, mysql, mariadb, mssql (and probably
others). But does _not_ work on, for example, oracle (and probably
others).

This is a, minimal impact, 'quick fix', better solution would be to go
through Django's database backend 'is_usable' method.

Fixes issue #3
  • Loading branch information
jor-rit authored and bittner committed Mar 4, 2020
1 parent b63dc95 commit 7bccfb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django_probes/management/commands/wait_for_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def wait_for_database(**opts):
# loop until we have a database connection or we run into a timeout
while True:
try:
connection.cursor().execute('SELECT')
connection.cursor().execute('SELECT 1')
if not conn_alive_start:
conn_alive_start = time()
break
Expand Down

0 comments on commit 7bccfb7

Please sign in to comment.