Open kdazzle opened 8 years ago
Ah, I think I figured out why it's crashing on the DATEFORMAT line.
The line in question is in pyodbc.base
:
cursor.execute('SET DATEFORMAT ymd; SET DATEFIRST %s' % datefirst)
The database that I'm connecting to is part of the Azure data warehouse and, according to these docs, DATEFORMAT
cannot be overridden.
Azure SQL Data Warehouse doesn't support many features that are fundamental for Django models (primary key, foreign keys, constraints etc.) as described in the document below. It would be nice if django-pyodbc-azure supports Azure SQL Data Warehouse, but it lacks feasibility unless Azure SQL Data Warehouse supports those features. https://docs.microsoft.com/en-us/azure/sql-data-warehouse/sql-data-warehouse-tables-overview#unsupported-table-features
I'm getting a couple of errors when connecting to a SQL Data Warehouse database in Azure:
Dateformat error
ESCAPE error
If I comment out the DATEFORMAT line mentioned above, I can get further, but error out on queries that use ESCAPE. For example, when I query
Foo.objects.filter(bar__icontains='B')
, the error is thus:So if I go to
pyodbc.base
and change theoperators
dict around line 103, and remove theESCAPE
operator aticontains
, then the query works.And that's fine for simple things, though I'm guessing that will introduce more errors and maybe the possibility of injection.
This is only my first day with Azure Data Warehouse, so I'm not sure yet if
ESCAPE
isn't allowed here or what the problem could be. It seems pretty arbitrary.Env
I'm using OSX and my Django settings are:
django-pyodbc-azure==1.10.0.1 pyodbc==3.0.10