1👍
✅
Just visit the docs here.
It was I think the second match on google with “Django ORM”.
EDIT See comments
If you look at this Django page you see that MySQLdb (the underlying layer) also accepts an init_command option which is run immediately after a connection is established. That’s a feature of MySQLdb, and not so much of Django itself.
1👍
If you are using django >= 1.2:
from django.db import connection, transaction
query = "SELECT foo FROM bar;"
connection.cursor().execute(query)
transaction.commit_unless_managed()
- [Answered ]-How to add link at top of django admin list
- [Answered ]-Save related models in one query
- [Answered ]-How to make sure that the UTC date saved in the database is equivalent to midnight in the specified timezone in Django
- [Answered ]-Django Views: DoesNotExist isn't working
- [Answered ]-Django Relation
Source:stackexchange.com