Skip to content

get_session should be available in dialog-lib instead #212

@lgabs

Description

@lgabs

from dialog.settings import Settings
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, DeclarativeBase
engine = create_engine(Settings().DATABASE_URL)
class Base(DeclarativeBase):
pass
def get_session(): # pragma: no cover
with Session(engine) as session:
yield session

When making plugins using dialog, it's useful to leverage from dialog-lib modules, which are available during development since dialog-lib is distributed package. But since dialog itself is not a package, this function get_session, for example, can not be inspected or accessed (specially when pytests runs and look at available modules). It's only accessed when we run the application using dialog's image.

I think I'd be a good idea to move this functionality to dialog-lib to make it available in the distributed package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions