Single database
from django.db import connection
with connection.cursor() as cursor:
cursor.execute('SELECT version()')
row = cursor.fetchone()
Multiple databases
from django.db import connections
with connections['my_db_alias'].cursor() as cursor:
cursor.execute('SELECT version()')
Reference connection:
Execute custom SQL directly
uses original cursors for multiple databases
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。