__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:OilLibrary 作者: NOAA-ORR-ERD 项目源码 文件源码
def _get_db_session():
    'we can call this from scripts to access valid DBSession'
    # not sure we want to do it this way - but let's use for now
    session = DBSession()

    try:
        eng = session.get_bind()

        if eng.url.database.split(os.path.sep)[-2:] != [__module_folder__,
                                                        _db_file]:
            raise UnboundExecutionError

    except UnboundExecutionError:
        session.bind = create_engine('sqlite:///' + _db_file_path)

    return session
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号