Django ODBC
django-odbc is a SQL Server DB backend powered by the pyodbc library. pyodbc is a mature, viable way to access SQL Server from Python in multiple platforms and is actively maintained. It's also used by SQLAlchemy for SQL Server connections.
Installation
Using pip
$ pip install django-odbc
Example
DATABASES = {
'default': {
'ENGINE': "django_odbc",
'HOST': "127.0.0.1,1433",
'USER': "mssql_user",
'PASSWORD': "mssql_password",
'NAME': "database_name",
'OPTIONS': {
'host_is_server': True
},
}
}
python -c 'import pyodbc; print(pyodbc.connect("DSN=foobar_mssql_data_source_name;UID=foo;PWD=bar").cursor().execute("select 1"))'
Settings
NAME String. Database name. Required.
HOST String. SQL Server instance in server\instance or ip,port format.
PORT String. SQL Server port.
USER String. Database user name. If not given then MS Integrated Security
will be used.
PASSWORD String. Database user password.
OPTIONS Dictionary. Current available keys:
-
driverString. ODBC Driver to use. Default is
"SQL Server"on Windows and"FreeTDS"on other platforms. -
dsnString. A named DSN can be used instead of
HOST. -
autocommitBoolean. Indicates if pyodbc should direct the the ODBC driver to activate the autocommit feature. Default value is
False. -
MARS_ConnectionBoolean. Only relevant when running on Windows and with SQL Server 2005 or later through MS SQL Server Native client driver (i.e. setting
driverto"SQL Server Native Client 11.0"). See http://msdn.microsoft.com/en-us/library/ms131686.aspx. Default value isFalse. -
host_is_serverBoolean. Only relevant if using the FreeTDS ODBC driver under Unix/Linux.
By default, when using the FreeTDS ODBC driver the value specified in the
HOSTsetting is used in aSERVERNAMEODBC connection string component instead of being used in aSERVERcomponent; this means that this value should be the name of a dataserver definition present in thefreetds.confFreeTDS configuration file instead of a hostname or an IP address.But if this option is present and it's value is True, this special behavior is turned off.
See http://freetds.org/userguide/dsnless.htm for more information.
-
extra_paramsString. Additional parameters for the ODBC connection. The format is
"param=value;param=value". -
collationString. Name of the collation to use when performing text field lookups against the database. For Chinese language you can set it to
"Chinese_PRC_CI_AS". The default collation for the database will be used if no value is specified. -
encodingString. Encoding used to decode data from this database. Default is 'utf-8'.
-
driver_needs_utf8Boolean. Some drivers (FreeTDS, and other ODBC drivers?) don't support Unicode yet, so SQL clauses' encoding is forced to utf-8 for those cases.
If this option is not present, the value is guessed according to the driver set.
-
limit_table_listBoolean. This will restrict the table list query to the dbo schema.
-
openedgeBoolean. This will trigger support for Progress Openedge
-
left_sql_quote,right_sql_quoteString. Specifies the string to be inserted for left and right quoting of SQL identifiers respectively. Only set these if django-pyodbc isn't guessing the correct quoting for your system.
Release files for django-odbc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_odbc-0.1.1.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_odbc-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 kB
Release files / django_odbc-0.1.1.tar.gz
| Download URL | django_odbc-0.1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a3a06abce280afad06bf4fab04c23071c029c2144a84ca9795fb14b2ee54f68
|
|
BLAKE2b-256 checksum How to use checksums |
e74fa02ba0772dca4b23cb77aca35547e7570621aba96790d74f8f4a49f3eecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / django_odbc-0.1.1-py3-none-any.whl
| Download URL | django_odbc-0.1.1-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad43ff9cdd953a8b69b0e60c9ea43b812fba6bc35e4cb08fd43a8c44304aec09
|
|
BLAKE2b-256 checksum How to use checksums |
db4c96cc2bb821b18104e5c8200e78e396c69fe5ccb13c6851251e5ac6e4a256
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|