I have django-pyodbc installed for Python 2.7 (Ubuntu 14.04, unixODBC, FreeTDS) and I am attempting to update a SQL Server database that I created as a test.
Everything works well except one particular UPDATE statement that does not affect any row. The same query executed via isql affects 258 rows (same result as if I run the query from Windows). BTW, a simple UPDATE statement works (ex: UPDATE mytable SET x=1). The query in question is based on 2 JOINS (one is a LEFT JOIN). Here it is:
UPDATE E
SET in_dico = 0
FROM entites_entite E
INNER JOIN entites_entitetype T
ON E.entite_type_id = T.id
LEFT JOIN entites_singleton S
ON LOWER(E.entite_name) = LOWER(S.entite_name)
WHERE E.entite_name NOT LIKE '% %'
AND T.exclude_singleton = 1
AND S.entite_name IS NULL
Does anyone know how such a thing possible? Regards, Patrick
EDIT: my DATABASE settings already include the autocommit parameter. Anyway, here it is:
DATABASES = {
'default': {
'ENGINE': "django_pyodbc",
'HOST': "myservername,1433",
'USER': "myname",
'PASSWORD': "mypassword",
'NAME': "mydbname",
'OPTIONS': {
'host_is_server': True,
'autocommit': True,
'driver': "FreeTDS"
},
'COMMAND_TIMEOUT': 7200,
}
}