Opened 10 years ago

Closed 10 years ago

#23889 closed Bug (fixed)

mysql warning: Calling a SQLCompiler directly is deprecated. Call compiler.quote_name_unless_alias instead.

Reported by: Collin Anderson Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Collin Anderson)

I'm using queryset.prefetch(Prefetch('etc')) on mysql on master.

Traceback:
File "/home/collin/pop/django/core/handlers/base.py" in get_response
  125.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/collin/pop/django/contrib/auth/decorators.py" in _wrapped_view
  22.                 return view_func(request, *args, **kwargs)
File "/home/collin/pop/resources/views.py" in home
  79.     cd = {c.id: c for c in collections}
File "/home/collin/pop/django/db/models/query.py" in __iter__
  161.         self._fetch_all()
File "/home/collin/pop/django/db/models/query.py" in _fetch_all
  989.             self._result_cache = list(self.iterator())
File "/home/collin/pop/django/db/models/query.py" in iterator
  289.         for row in compiler.results_iter():
File "/home/collin/pop/django/db/models/sql/compiler.py" in results_iter
  725.         for rows in self.execute_sql(MULTI):
File "/home/collin/pop/django/db/models/sql/compiler.py" in execute_sql
  811.             sql, params = self.as_sql()
File "/home/collin/pop/django/db/models/sql/compiler.py" in as_sql
  112.         where, w_params = self.compile(self.query.where)
File "/home/collin/pop/django/db/models/sql/compiler.py" in compile
  83.             return node.as_sql(self, self.connection)
File "/home/collin/pop/django/db/models/sql/where.py" in as_sql
  105.                     sql, params = compiler.compile(child)
File "/home/collin/pop/django/db/models/sql/compiler.py" in compile
  83.             return node.as_sql(self, self.connection)
File "/home/collin/pop/django/db/models/sql/where.py" in as_sql
  423.         return query_compiler.as_subquery_condition(self.alias, self.columns, compiler)
File "/home/collin/pop/django/db/backends/mysql/compiler.py" in as_subquery_condition
  8.         return '(%s) IN (%s)' % (', '.join('%s.%s' % (qn(alias), qn2(column)) for column in columns), sql), params
File "/home/collin/pop/django/db/backends/mysql/compiler.py" in <genexpr>
  8.         return '(%s) IN (%s)' % (', '.join('%s.%s' % (qn(alias), qn2(column)) for column in columns), sql), params
File "/home/collin/pop/django/db/models/sql/compiler.py" in __call__
  58.             RemovedInDjango20Warning, stacklevel=2)
File "/home/collin/pop/settings_local.py" in new_warn
  11.     raise Exception(repr(args))
 
Exception Type: Exception at /file-library/
Exception Value: ('Calling a SQLCompiler directly is deprecated. Call compiler.quote_name_unless_alias instead.', <class 'django.utils.deprecation.RemovedInDjango20Warning'>)

Change History (4)

comment:2 by Collin Anderson, 10 years ago

Description: modified (diff)

comment:3 by Tim Graham, 10 years ago

Triage Stage: UnreviewedReady for checkin

I'd be grateful if you could fix this instance as well:

/django/db/models/expressions.py:524: RemovedInDjango20Warning: 
 Calling a SQLCompiler directly is deprecated. Call compiler.quote_name_unless_alias instead.
  return "%s" % compiler(self.refs), []

comment:4 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In d4ea4eea7995edd75061777fe7223c5871d6938c:

Fixed #23889 -- Added more usage of quote_name_unless_alias() to avoid deprecation warnings.

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