Code

Opened 8 years ago

Closed 8 years ago

#1258 closed enhancement (duplicate)

[Patch] MS-SQL backend via pymssql

Reported by: Cheng <czhang.cmu+web@…> Owned by: adrian
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: UI/UX:

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@…> 8 years ago.
patch for pymssql
mssql.py (5.6 KB) - added by Cheng <czhang.cmu+web@…> 8 years ago.
django/core/db/backend/mssql.py
mssql-django.patch (5.6 KB) - added by Cheng <czhang.cmu+web@…> 8 years ago.
patch for other files

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Cheng <czhang.cmu+web@…>

patch for pymssql

Changed 8 years ago by Cheng <czhang.cmu+web@…>

django/core/db/backend/mssql.py

Changed 8 years ago by Cheng <czhang.cmu+web@…>

patch for other files

comment:1 Changed 8 years ago by adrian

  • Resolution set to duplicate
  • Status changed from new to closed

Closed in favor of #1429.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.