Comments (4)
Hi, i have the same problem.
Could you resolve this issue?
How??
Best Regards,
Julio Sánchez.
from django-pyodbc.
I did finally resolve it, but after a year or so I'm having trouble remembering. Over the last few years I've actually made a few little patches to pyodbc that made it work better with django. Looking through git logs I think I made a simple patch to the pyodbc/compiler.py file.
In the file there's a function "as_sql", and in there I swapped out:
if self.return_id and self.connection.features.can_return_id_from_insert:
params = params[0]
output = 'OUTPUT inserted.%s' % qn(opts.pk.column)
result.append(output)
result.append("VALUES (%s)" % ", ".join(placeholders[0]))
return [(" ".join(result), tuple(params))]
with:
if self.return_id and self.connection.features.can_return_id_from_insert:
params = params[0]
#TODO: ryan commented out old output method and replace with scope_identity
# output = 'OUTPUT inserted.%s' % qn(opts.pk.column)
# result.append(output)
result.append("VALUES (%s)" % ", ".join(placeholders[0]))
result.append("SELECT SCOPE_IDENTITY()")
return [(" ".join(result), tuple(params))]
... let me know if that doesn't work and i'll dig into it a bit more
from django-pyodbc.
Thanks eviltandem for your support!!
mmmm but this code is just under where i get the error code..
result.append('INSERT INTO %s' % qn(opts.db_table))
result.append('(%s)' % ', '.join([qn(c) for c in self.query.columns])) # <=== here is the error
if self.return_id and self.connection.features.can_return_id_from_insert:
params = params[0]
#TODO: ryan commented out old output method and replace with scope_identity
# output = 'OUTPUT inserted.%s' % qn(opts.pk.column)
# result.append(output)
result.append("VALUES (%s)" % ", ".join(placeholders[0]))
result.append("SELECT SCOPE_IDENTITY()")
return [(" ".join(result), tuple(params))]
Can you give me the columns part? Or maybe all the compile.py
BR,
Julio Sánchez.
from django-pyodbc.
Done!, I was replace all the as_sql code to the as_code from Github lastest version.
It Works!!
Thanks a lot eviltandem!!
Best Regards,
Julio Sánchez.
from django-pyodbc.
Related Issues (20)
- aggregate_select() removed in Django 1.10 HOT 2
- OpenEdge support not working in master. Some basic fixes here
- django.core.exceptions.ImproperlyConfigured: Django 1.11 is not supported. HOT 4
- as_sql() got an unexpected keyword argument 'subquery' HOT 5
- Please update for Django 1.11.1 HOT 5
- Conversion failed when converting date and/or time from character string. HOT 2
- pyodbc.DataError: Conversion failed when converting da te and/or time from character string HOT 1
- SchemaEditor error HOT 1
- unixODBC config files HOT 1
- Using for dbf files HOT 1
- Django 2.0 Alpha inspectdb command fails
- django-pyodbc query with OFFSET+LIMIT issue
- Active maintainer needed HOT 9
- No default encoding (2.0.0a1) HOT 3
- Error: SchemaEditorClass HOT 1
- Different schemas in models.py HOT 1
- django odbc connection to production SQL server 2014 from windows machine HOT 1
- Help in setting up connection with load balancer HOT 1
- Sql server 2019 connection string issue from django project HOT 1
- Database error conection using django-pyodbc to connect to SQL Server 2019 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-pyodbc.