def create_database_session(engine):
    """Connect to the database"""

    try:
        Session = sessionmaker(bind=engine)
        return Session()
    except OperationalError as e:
        raise DatabaseError(error=e.orig.args[1], code=e.orig.args[0])
def create_database_session ( engine ) : try : Session = sessionmaker ( bind = engine ) return Session ( ) except OperationalError as e : raise DatabaseError ( error = e . orig . args [ 1 ] , code = e . orig . args [ 0 ] )
Connect to the database