0

I'm using SQLAlchemy from within Django, and I can access the thread-local database connection object in Django:

from django.db import connection

Given that connection object, can I use it to instantiate a SQLAlchemy engine?

All of the documentation I've read about creating a SQLAlchemy engine requires providing a database URL string.

Is there a way I can create an SA engine by providing an existing connection?

My goal here is to avoid opening 2 database connections where I do not have to.

maxm
  • 5,161
  • 7
  • 30
  • 33

0 Answers0