Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Documented a limit of the SQLite backend, in relation with the bulk_c…

…reate function. Refs #17788.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17653 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cfd0cd1bc900b24e6206ca065520eef91d3ca3fa 1 parent 20b021e
Aymeric Augustin authored March 04, 2012

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. 15  docs/ref/models/querysets.txt
15  docs/ref/models/querysets.txt
@@ -1371,6 +1371,21 @@ This has a number of caveats though:
1371 1371
 * If the model's primary key is an :class:`~django.db.models.AutoField` it
1372 1372
   does not retrieve and set the primary key attribute, as ``save()`` does.
1373 1373
 
  1374
+.. admonition:: Limits of SQLite
  1375
+
  1376
+    SQLite sets a limit on the number of parameters per SQL statement. The
  1377
+    maximum is defined by the SQLITE_MAX_VARIABLE_NUMBER_ compilation option,
  1378
+    which defaults to 999. For instance, if your model has 8 fields (including
  1379
+    the primary key), you cannot create more than 999 // 8 = 124 instances at
  1380
+    a time. If you exceed this limit, you will get an exception::
  1381
+
  1382
+        django.db.utils.DatabaseError: too many SQL variables
  1383
+
  1384
+    If your application's performance requirements exceed SQLite's limits, you
  1385
+    should switch to another database engine, such as PostgreSQL.
  1386
+
  1387
+.. _SQLITE_MAX_VARIABLE_NUMBER: http://sqlite.org/limits.html#max_variable_number
  1388
+
1374 1389
 count
1375 1390
 ~~~~~
1376 1391
 

0 notes on commit cfd0cd1

Please sign in to comment.
Something went wrong with that request. Please try again.