Opened 18 years ago

Closed 18 years ago

#1258 closed enhancement (duplicate)

[Patch] MS-SQL backend via pymssql

Reported by: Cheng <czhang.cmu+web@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (3)

pymssql.patch (1.6 KB ) - added by Cheng <czhang.cmu+web@…> 18 years ago.
patch for pymssql
mssql.py (5.6 KB ) - added by Cheng <czhang.cmu+web@…> 18 years ago.
django/core/db/backend/mssql.py
mssql-django.patch (5.6 KB ) - added by Cheng <czhang.cmu+web@…> 18 years ago.
patch for other files

Download all attachments as: .zip

Change History (4)

by Cheng <czhang.cmu+web@…>, 18 years ago

Attachment: pymssql.patch added

patch for pymssql

by Cheng <czhang.cmu+web@…>, 18 years ago

Attachment: mssql.py added

django/core/db/backend/mssql.py

by Cheng <czhang.cmu+web@…>, 18 years ago

Attachment: mssql-django.patch added

patch for other files

comment:1 by Adrian Holovaty, 18 years ago

Resolution: duplicate
Status: newclosed

Closed in favor of #1429.

Note: See TracTickets for help on using tickets.
Back to Top