DESCRIPTION.rst 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Goals
  2. -----
  3. django-pymssql is a Django database backend for Microsoft SQL Server that
  4. works on non-Windows systems.
  5. It's a small wrapper around django-mssql_ that uses pymssql_ instead of ADO to
  6. connect to SQL Server.
  7. It should support the same versions of Python, Django and SQL Server as
  8. django-mssql_.
  9. The original use case was to connect to SQL Server from a Django project
  10. written in Python 3 and running on Linux.
  11. Status
  12. ------
  13. django-pymssql 1.7 almost_ passes Django's test suite with:
  14. - Python 2.7 or 3.4
  15. - Django 1.7.x + django-mssql 1.6.1 + pymssql 2.1.1
  16. - Microsoft® SQL Server® 2012 Express
  17. Usage
  18. -----
  19. django-pymssql provides a Django database engine called ``sqlserver_pymssql``:
  20. .. code-block:: python
  21. DATABASES = {
  22. 'default': {
  23. 'ENGINE': 'sqlserver_pymssql',
  24. 'HOST': '...',
  25. 'NAME': '...',
  26. 'USER': '...',
  27. 'PASSWORD': '...','
  28. 'OPTIONS': {
  29. # ...
  30. },
  31. },
  32. }
  33. Any parameter accepted by `pymssql.connect`_ can be passed in OPTIONS.
  34. Alternatives
  35. ------------
  36. django-sqlserver_ is a fork of django-mssql_ that supports python-tds_ and
  37. pymssql_ in addition to ADO on Windows. Unfortunately it has diverged and it
  38. lags behind django-mssql_ when it comes to supporting newer Django versions.
  39. django-pyodbc_ relies on pyodbc_ to connect to SQL Server. It requires a
  40. complex stack that doesn't bring actual benefits. Besides it doesn't appear
  41. to be very mature nor actively maintained.
  42. Hacking
  43. -------
  44. Clone Django, pymssql, django-mssql and django-pymssql and ``pip install -e
  45. .`` each of them in a virtualenv.
  46. Create a Django tests settings file with the database engine set to
  47. ``'sqlserver_pymssql'`` and credentials for a testing SQL Server instance.
  48. Go the the ``tests`` subdirectory in a clone of Django and execute
  49. ``./runtests.py --settings=test_pymssql``.
  50. License
  51. -------
  52. django-pymssql is released under the MIT license, like django-mssql_. See the
  53. LICENSE file for details. Note that pymssql_ is released under the LGPL.
  54. Some database version checking code was borrowed from django-sqlserver_ which
  55. is also released under the MIT license..
  56. .. _almost: https://github.com/aaugustin/django-pymssql/search?q=failing_tests
  57. .. _django-mssql: http://django-mssql.readthedocs.org/
  58. .. _django-pyodbc: https://github.com/lionheart/django-pyodbc
  59. .. _django-sqlserver: https://github.com/denisenkom/django-sqlserver
  60. .. _pymssql: http://www.pymssql.org/
  61. .. _pymssql.connect: http://pymssql.org/en/latest/ref/pymssql.html#pymssql.connect
  62. .. _pyodbc: https://github.com/mkleehammer/pyodbc
  63. .. _python-tds: https://github.com/denisenkom/pytds