Django

Code

Ticket #1258 (closed: duplicate)

Opened 3 years ago

Last modified 3 years ago

[Patch] MS-SQL backend via pymssql

Reported by: Cheng <czhang.cmu+web@gmail.com> Assigned to: adrian
Milestone: Component: Database layer (models, ORM)
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The patches are based on the work of Jakub Labath <jlabath_AT_gmail.com>. I merely helped to cut the doctest errors down to 2.

This wrapper requires pymssql. I tested with pymssql 0.7.3. A patch of pymssql is attached for boolean typecast and autocommit. The patches tested with Django [2100]. 2 errors left:

'subclassing' module: API test failed
=====================================
Code: 'a3.pub_date'
Line: 66
Expected: 'datetime.date(2005, 8, 22)\n'
Got: 'datetime.datetime(2005, 8, 22, 0, 0)\n'

'subclassing' module: API test failed
=====================================
Code: 'a4.pub_date'
Line: 86
Expected: 'datetime.date(2005, 8, 22)\n'
Got: 'datetime.datetime(2005, 8, 22, 0, 0)\n'
2 errors:

The pymssql provides no hook to do custom typecasts. With the hints from this email thread, I still couldn't find a place to cast MSSQL's native datetime to date or time, if the field type is 'DateField?' or 'TimeField?'.

BTW: I just noticed that pymssql says it works on Windows as well. I didn't test it, but if so, it's more flexible than adodbapi then.

Attachments

pymssql.patch (1.6 kB) - added by Cheng <czhang.cmu+web@gmail.com> on 01/21/06 18:59:10.
patch for pymssql
mssql.py (5.6 kB) - added by Cheng <czhang.cmu+web@gmail.com> on 01/21/06 19:00:22.
django/core/db/backend/mssql.py
mssql-django.patch (5.6 kB) - added by Cheng <czhang.cmu+web@gmail.com> on 01/21/06 19:01:43.
patch for other files

Change History

01/21/06 18:59:10 changed by Cheng <czhang.cmu+web@gmail.com>

  • attachment pymssql.patch added.

patch for pymssql

01/21/06 19:00:22 changed by Cheng <czhang.cmu+web@gmail.com>

  • attachment mssql.py added.

django/core/db/backend/mssql.py

01/21/06 19:01:43 changed by Cheng <czhang.cmu+web@gmail.com>

  • attachment mssql-django.patch added.

patch for other files

05/04/06 23:43:01 changed by adrian

  • status changed from new to closed.
  • resolution set to duplicate.

Closed in favor of #1429.


Add/Change #1258 ([Patch] MS-SQL backend via pymssql)




Change Properties
Action