当前位置: 首页>>代码示例>>Python>>正文


Python Bunch.session方法代码示例

本文整理汇总了Python中galaxy.util.bunch.Bunch.session方法的典型用法代码示例。如果您正苦于以下问题:Python Bunch.session方法的具体用法?Python Bunch.session怎么用?Python Bunch.session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在galaxy.util.bunch.Bunch的用法示例。


在下文中一共展示了Bunch.session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from galaxy.util.bunch import Bunch [as 别名]
# 或者: from galaxy.util.bunch.Bunch import session [as 别名]
def init( file_path, url, engine_options={}, create_tables=False ):
    """Connect mappings to the database"""
    # Load the appropriate db module
    load_egg_for_url( url )
    # Create the database engine
    engine = create_engine( url, **engine_options )
    # Connect the metadata to the database.
    metadata.bind = engine
    # Clear any existing contextual sessions and reconfigure
    Session.remove()
    Session.configure( bind=engine )
    # Create tables if needed
    if create_tables:
        metadata.create_all()
    # Pack everything into a bunch
    result = Bunch( **globals() )
    result.engine = engine
    result.session = Session
    result.create_tables = create_tables
    #load local galaxy security policy
    result.security_agent = CommunityRBACAgent( result )
    result.shed_counter = ShedCounter( result )
    return result
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:25,代码来源:mapping.py

示例2: Bunch

# 需要导入模块: from galaxy.util.bunch import Bunch [as 别名]
# 或者: from galaxy.util.bunch.Bunch import session [as 别名]
import sys
sys.path.insert(1,'/galaxy-central')
sys.path.insert(1,'/galaxy-central/lib')

from scripts.db_shell import *
from galaxy.util.bunch import Bunch
from galaxy.security import GalaxyRBACAgent
from sqlalchemy.orm import sessionmaker
from sqlalchemy import *
import argparse
bunch = Bunch( **globals() )
engine = create_engine('postgres://galaxy:[email protected]:5432/galaxy')
bunch.session = sessionmaker(bind=engine)
# For backward compatibility with "model.context.current"
bunch.context = sessionmaker(bind=engine)

security_agent = GalaxyRBACAgent( bunch )
security_agent.sa_session = sa_session


def add_user(email, password, key=None):
    """
        Add Galaxy User.
        From John https://gist.github.com/jmchilton/4475646
    """
    query = sa_session.query( User ).filter_by( email=email )
    if query.count() > 0:
        return query.first()
    else:
        User.use_pbkdf2 = False
        user = User(email)
开发者ID:abdulrahmanazab,项目名称:docker-galaxy-stable,代码行数:33,代码来源:create_galaxy_user.py


注:本文中的galaxy.util.bunch.Bunch.session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。