Commits

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.

  • Participants
  • Parent commits 730544d

Comments (0)

Files changed (5)

File docs/changelog.txt

 - 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`.
 
 v1.1
 ----

File docs/index.txt

     commands
     datatypes
     testing
-    changelog
+    changelog
+
+.. toctree::
+    :maxdepth: 1
+    
+    known-issues

File docs/known-issues.txt

+.. 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``.

File tests/test_inspectdb/create_database.sql

 
 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)
 )
 go
 

File tests/test_inspectdb/settings.py

 hack_path()
 from dbsettings import *
 
-DEBUG = True
+DEBUG = False
 TEMPLATE_DEBUG = DEBUG
 
 ADMINS = (
 
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
-    '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',
 )
 
 MIDDLEWARE_CLASSES = (