Replies: 1 comment
-
Using In your current implementation, you're directly creating an Here's a brief explanation of the changes:
This change might help address the performance issues you're experiencing with multithreading and querying the PostgreSQL database. It can also make your code cleaner and more maintainable by encapsulating session creation logic within the factory. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
\langflow\services\database\service.py
@asynccontextmanager
async def with_session(self):
async with AsyncSession(self.engine, expire_on_commit=False) as session:
yield session
Do we need to use async_sessionmaker like this:
from sqlalchemy.ext.asyncio import async_sessionmaker
class DatabaseService(Service):
name = "database_service"
Beta Was this translation helpful? Give feedback.
All reactions