Tôi có một dự án Django sử dụng nhiều cơ sở dữ liệu. https://docs.djangoproject.com/en/dev/topics/db/multi-db/Django, nhiều cơ sở dữ liệu với sql thô. Làm thế nào để chọn db?
tôi thực hiện rất nhiều thắc mắc liệu như thế này:
cursor = connection.cursor()
cursor.execute("select * from my_table")
....
transaction.commit_unless_managed()
Làm thế nào tôi có thể xác định cơ sở dữ liệu sử dụng không?
Bạn đã thử 'transaction.commit_unless_managed (using = 'database_entry')'? – arulmr
Không ai có liên quan đến tài liệu thực tế, rất rõ ràng: https://docs.djangoproject.com/en/dev/topics/db/transactions/ –