Opened 6 years ago

Closed 5 years ago

#12058 closed (fixed)

resetting an app (manage.py reset) with a --database option results in an AttributeError: 'str' object has no attribute 'introspection'

Reported by: lemuelf Owned by: nobody
Component: Core (Management commands) Version: soc2009/multidb
Severity: Keywords: multidb
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

when doing a manage.py reset of an app with a --database option results in

Traceback (most recent call last):

File "./manage.py", line 11, in <module>

execute_manager(settings)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/init.py", line 439, in execute_manager

utility.execute()

File "/usr/local/lib/python2.6/dist-packages/django/core/management/init.py", line 380, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 195, in run_from_argv

self.execute(*args, options.dict)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 222, in execute

output = self.handle(*args, options)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 286, in handle

app_output = self.handle_app(app, options)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/reset.py", line 33, in handle_app

sql_list = sql_reset(app, self.style, connection)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py", line 119, in sql_reset

return sql_delete(app, style, connection) + sql_all(app, style, connection)

File "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py", line 99, in sql_delete

if connection.introspection.table_name_converter(model._meta.db_table) in table_names:

AttributeError: 'str' object has no attribute 'introspection'

this is because the "dbs" variable expects a list of connection instances but when given a --database option it is set with a list of the database name instead.

Attachments (1)

reset-with-database-option.diff (523 bytes) - added by lemuelf 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by lemuelf

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed

Fixed inadvertently by a change to the way reset interacts with multiple databases.

Note: See TracTickets for help on using tickets.
Back to Top