First I create a session as follows:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
some_engine = create_engine('my_engine_string')
Session = sessionmaker(bind=some_engine)
session = Session()
Then I send this session as an argument to a method
def example(session):
print("you created a session!")
Is it possible to get the value of some_engine from session inside the example method? without actually passing some_engine or my_engine_string to example method.
Something as below:
def example(session):
print("you created a session!")
engine = <using session get the value of `some_engine`>
print("the engine is retrieved from session")