Michael Manfre avatar Michael Manfre committed 980f1e1

Fixed #12 - Documented known issue with inspectdb and column names with '%'

When DEBUG = True, introspecting a table containing a column with a '%' in its
name will result in "TypeError: not enough arguments for format string" being
thrown by CursorDebugWrapper. The workaround is to set 'DEBUG = False' in
settings.py while running 'manage.py inspectdb' or rename the database column.

Comments (0)

Files changed (5)


 - Changed provider default from 'SQLOLEDB' to 'SQLNCLI10' with MARS enabled.
 - Added :ref:`rawstoredproceduremanager`, which provides ``raw_callproc`` that works the same as ``raw``, except
   expects the name of a stored procedure that returns a result set that matches the model.
+- Documented known issue with database introspection with ``DEBUG = True`` and column names containing '%'.
+  See :ref:`introspecting-percent-columns`.
-    changelog
+    changelog
+.. toctree::
+    :maxdepth: 1
+    known-issues


+.. section: known-issues
+Known Issues
+.. _introspecting-percent-columns:
+Introspecting tables with '%' columns
+Attempting to run ``manage.py inspectdb`` with ``DEBUG = True`` will raise 
+``TypeError: not enough arguments for format string``. This is due to ``CursorDebugWrapper``
+and its use of % format strings. If you encounter this problem, you can either rename
+the database column so it does not include a '%' (percent) character, or ``DEBUG = False`` 
+when you run ``manage.py inspectdb``.


 create table [table has spaces] (
 	[Create User] [nvarchar](30) NULL DEFAULT (''),
-	[Create Timestamp] [datetime] NOT NULL DEFAULT (getdate())
+	[Create Timestamp] [datetime] NOT NULL DEFAULT (getdate()),
+	[Column with %] [int] NOT NULL DEFAULT (0)


 from dbsettings import *
-DEBUG = True
+DEBUG = False
 # List of callables that know how to import templates from various sources.
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.