following code:
from django.db import connection
from sqlalchemy import create_engine
def get_connection():
if connection.connection is None:
connection._cursor() # TODO: better way to open new
connection?
return connection.connection
engine = create_engine('postgresql+psycopg2://',
creator=get_connection)
engine.execute(s) # s - SqlAlchemy query
But this results in various fails in SqlAchemy (like connection is
already closed, can't execute some queries). More details are
available here: http://stackoverflow.com/questions/6439119/django-and-sqlalchemy-share-connection
So I have following question:
- does anyone know working solution?
- how big will be performance impact if I use separate connection for
Django and SqlAlchemy?
- any explanations why current code is not working :)
Thanks.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment