diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-10-10 20:14:56 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-10-10 20:14:56 +0000 |
| commit | 29ff2bb4cbc7ffa3193ba0cec48308cf0f4c1295 (patch) | |
| tree | b5a80810b1c1a67bcf5f76c5960d95016ce04a69 | |
| parent | 474cfe56d4a9563f5acf5846f718e480752d4ff3 (diff) | |
Improved django.core.management.get_sql_delete to close database connection explicitly when it's done, to avoid locking issues
git-svn-id: http://code.djangoproject.com/svn/django/trunk@823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/management.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/core/management.py b/django/core/management.py index afb498ae63..046031e311 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -144,6 +144,10 @@ def get_sql_delete(mod): for row in cursor.fetchall(): output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0]) + # Close database connection explicitly, in case this output is being piped + # directly into a database client, to avoid locking issues. + db.db.close() + return output[::-1] # Reverse it, to deal with table dependencies. get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given model module name(s)." get_sql_delete.args = APP_ARGS |
