home / django_tickets / tickets

tickets: 10070

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
10070 2009-01-19 19:41:46 2020-12-29 19:55:54 2022-03-06 03:46:23.124309 Accepted new Database layer (models, ORM) Bug Normal dev   Named parameters not working on raw sql queries with sqlite The following code shows the problem when using sqlite: {{{ $ python manage.py shell Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from django.db import connection >>> c = connection.cursor() >>> c.execute("select name from inventory_host where id=%(id)s",{'id':'1'}) Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) File "/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 167, in execute query = self.convert_query(query, len(params)) File "/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 179, in convert_query return query % tuple("?" * num_params) TypeError: format requires a mapping >>> >>> import django >>> django.VERSION (1, 0, 2, 'final', 0) }}} {{{ $ sqlite3 --version 3.5.9 }}} When using Mysql or Postgres, that works (not tested by me, but by others on django-users). nobody msurdi   0 1 0 1 0 0
Powered by Datasette · Queries took 1.186ms