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


Python DBSession.remove方法代码示例

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


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

示例1: setup

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setup(settings=None):
    """Utility function that helps to connect the system to the given database.

    if the database is None then the it setups using the default database in
    the settings file.

    :param settings: This is a dictionary which has keys prefixed with
        "sqlalchemy" and shows the settings. The most important one is the
        engine. The default is None, and in this case it uses the settings from
        stalker.config.Config.database_engine_settings
    """

    if settings is None:
        settings = defaults.database_engine_settings
        logger.debug("no settings given, using the default: %s" % settings)

    logger.debug("settings: %s" % settings)
    # create engine
    engine = engine_from_config(settings, "sqlalchemy.")

    logger.debug("engine: %s" % engine)

    # create the Session class
    DBSession.remove()
    DBSession.configure(bind=engine, extension=None)

    # create the database
    logger.debug("creating the tables")
    Base.metadata.create_all(engine)

    # update defaults
    update_defaults_with_studio()
开发者ID:GreenEminence,项目名称:stalker,代码行数:34,代码来源:__init__.py

示例2: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
    def tearDown(self):
        os.rmdir(self.test_repo.linux_path)
        os.rmdir(self.test_repo.windows_path)
        os.rmdir(self.test_repo.osx_path)

        DBSession.remove()
        testing.tearDown()
开发者ID:Dr-Rakcha,项目名称:stalker-pyramid,代码行数:9,代码来源:test_version.py

示例3: setup

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
def setup(settings=None):
    """Utility function that helps to connect the system to the given database.

    if the database is None then the it setups using the default database in
    the settings file.

    :param settings: This is a dictionary which has keys prefixed with
        "sqlalchemy" and shows the settings. The most important one is the
        engine. The default is None, and in this case it uses the settings from
        stalker.config.Config.database_engine_settings
    """

    if settings is None:
        settings = defaults.database_engine_settings
        logger.debug('no settings given, using the default: %s' % settings)

    logger.debug("settings: %s" % settings)
    # create engine
    engine = engine_from_config(settings, 'sqlalchemy.')

    logger.debug('engine: %s' % engine)

    # create the Session class
    DBSession.remove()
    DBSession.configure(
        bind=engine,
        extension=None
    )

    # check alembic versions of the database
    # and raise an error if it is not matching with the system
    check_alembic_version()

    # create the database
    logger.debug("creating the tables")
    Base.metadata.create_all(engine)

    # update defaults
    update_defaults_with_studio()

    # create repo env variables
    create_repo_vars()
开发者ID:Industriromantik,项目名称:stalker,代码行数:44,代码来源:__init__.py

示例4: setUpClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def setUpClass(cls):
     """set up the test for class
     """
     DBSession.remove()
开发者ID:GreenEminence,项目名称:stalker,代码行数:6,代码来源:test_user.py

示例5: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDown(self):
     """tear down the test
     """
     DBSession.remove()
开发者ID:GreenEminence,项目名称:stalker,代码行数:6,代码来源:test_user.py

示例6: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDown(self):
     """clean up the test
     """
     DBSession.remove()
开发者ID:Industriromantik,项目名称:stalker,代码行数:6,代码来源:test_statusMixin.py

示例7: tearDownClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDownClass(cls):
     """clear test in class level
     """
     DBSession.remove()
开发者ID:Industriromantik,项目名称:stalker,代码行数:6,代码来源:test_statusMixin.py

示例8: setUpClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def setUpClass(cls):
     """setup test in class level
     """
     DBSession.remove()
开发者ID:Industriromantik,项目名称:stalker,代码行数:6,代码来源:test_statusMixin.py

示例9: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDown(self):
     from stalker.db.session import DBSession
     DBSession.remove()
开发者ID:2008chny,项目名称:stalker,代码行数:5,代码来源:test_scheduleMixin.py

示例10: Status

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

from stalker import db, User
from stalker.models.asset import Asset
from stalker.models.project import Project
from stalker.models.repository import Repository
from stalker.db.session import DBSession
from stalker.models.status import Status, StatusList
from stalker.models.task import Task
from stalker.models.type import Type

DBSession.remove()
DBSession.configure(extension=None)
db.setup()

status1 = Status(name="Complete", code="CMPLT")
status2 = Status(name="Pending Review", code="PRev")

repo1 = Repository(name="TestRepo")

project_status_list = StatusList(
    name="test",
    target_entity_type=Project,
    statuses=[status1]
)

project_type = Type(
开发者ID:2008chny,项目名称:stalker,代码行数:33,代码来源:test_generic_db.py

示例11: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDown(self):
     """clean up the test
     """
     DBSession.remove()
     # restore defaults.timing_resolution
     defaults.timing_resolution = datetime.timedelta(hours=1)
开发者ID:2008chny,项目名称:stalker,代码行数:8,代码来源:test_dateRangeMixin.py

示例12: tearDown

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDown(self):
     DBSession.remove()
     testing.tearDown()
开发者ID:Dr-Rakcha,项目名称:stalker-pyramid,代码行数:5,代码来源:test_asset.py

示例13: tearDownClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDownClass(cls):
     """cleanup the test in class level
     """
     DBSession.remove()
     DBSession.configure()
开发者ID:2008chny,项目名称:stalker,代码行数:7,代码来源:test_aclMixin.py

示例14: setUpClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def setUpClass(cls):
     """setup the test in class level
     """
     DBSession.remove()
     DBSession.configure()
开发者ID:2008chny,项目名称:stalker,代码行数:7,代码来源:test_aclMixin.py

示例15: tearDownClass

# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import remove [as 别名]
 def tearDownClass(cls):
     """clean up the test
     """
     DBSession.remove()
开发者ID:GreenEminence,项目名称:stalker,代码行数:6,代码来源:test_user.py


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