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


Python Project.get_database_impl方法代码示例

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


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

示例1: upgrade

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_database_impl [as 别名]
    def upgrade(my):
        project_code = my.kwargs.get('project_code')
        # run the upgrade script (this has to be done in a separate
        # process due to possible sql errors in a transaction
        install_dir = Environment.get_install_dir()
        python = Config.get_value("services", "python")
        if not python:
            python = "python"

        impl = Project.get_database_impl()

        from pyasm.search.upgrade import Upgrade
        version = Environment.get_release_version()
        version.replace('.', '_')
        upgrade = Upgrade(version, is_forced=True, project_code=project_code, quiet=True)
        upgrade.execute()
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:18,代码来源:create_project_cmd.py

示例2: _test_project

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_database_impl [as 别名]
    def _test_project(self):

        from pyasm.biz import Project
        sql = Project.get_database_impl()

        # Don't bother running if you don't have sample3d
        if not sql.database_exists('sample3d'):
            return


        Project.set_project("sthpw")

        sobject = SearchType.create('prod/shot?project=sample3d', columns=['code', 'sequence_code', 'pipeline_code'], result=['S001','HT001','shot'])
        self.assertEquals("prod/shot?project=sample3d", sobject.get_search_type())
       
        if sql.database_exists('sample3d'):
            db_resource = Project.get_db_resource_by_search_type('prod/bin?project=sample3d')
            exists= sql.table_exists(  db_resource ,'bin')
            if exists:
                search = Search('prod/bin', project_code='sample3d')
                self.assertEquals("prod/bin?project=sample3d", search.get_search_type())
        # check that a search type is properly created
        search_type = SearchType.get("prod/shot?project=sample3d")
        base_key = search_type.get_base_key()
        self.assertEquals("prod/shot", base_key)

    
        # NOTE: search_type get_full_key() method is deprecated.
       


        # test that the sobject maintains the search type
        sobject = SearchType.create("prod/shot?project=sample3d")
        search_type = sobject.get_search_type()
        self.assertEquals("prod/shot?project=sample3d", search_type)

        # set it back to unittest
        Project.set_project("unittest")

        # test current project is added when there is not project set
        sobject = SearchType.create("prod/shot")
        search_type = sobject.get_search_type()
        self.assertEquals("prod/shot?project=unittest", search_type)


        # test current project is added when there is not project set, even
        # when the project has changed
        sobject = SearchType.create("prod/shot")
        
        search_type = sobject.get_search_type()
        self.assertEquals("prod/shot?project=unittest", search_type)

        if sql.database_exists('sample3d'):
            Project.set_project("sample3d")

            project_code = Project.get_project_code()
            self.assertEquals("sample3d", project_code)

        # set it back to unittest project
        Project.set_project("unittest")

        # test the search
        if sql.database_exists('sample3d'):
            search_type = "prod/shot?project=sample3d"
            search = Search(search_type)
            project_code = search.get_project_code()
            self.assertEquals("sample3d", project_code)

            # test the search project code even though the project has hanved
            search_type = "prod/shot?project=sample3d"
            search = Search(search_type)
            project_code = search.get_project_code()
            self.assertEquals("sample3d", project_code)

            Project.set_project("admin")
            project_code = search.get_project_code()
            self.assertEquals("sample3d", project_code)

            project_code = Project.get_project_code()
            self.assertEquals("admin", project_code)

        # set it back to unittest project
        Project.set_project("unittest")
开发者ID:mincau,项目名称:TACTIC,代码行数:85,代码来源:search_test.py


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