單資料庫
from django.db import connection
with connection.cursor() as cursor:
cursor.execute('SELECT version()')
row = cursor.fetchone()
多資料庫
from django.db import connections
with connections['my_db_alias'].cursor() as cursor:
cursor.execute('SELECT version()')