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


Python DbHelper.upgrade_do方法代码示例

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


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

示例1: print

# 需要导入模块: from domogik.common.database import DbHelper [as 别名]
# 或者: from domogik.common.database.DbHelper import upgrade_do [as 别名]
                        print("New device:      {0}({1})".format(newDev[(seln - 1)]["name"], newDev[(seln - 1)]['id']))
                        print("New sensor:      {0}({1})".format(newDev[(seln - 1)]["sensors"][selS]["name"], newDev[(seln - 1)]["sensors"][selS]["id"]))
                        print("")
                        print("WARNING:")
                        print("By typing YES below this will start the upgrade process, after the process")
                        print("the upgraded stats keys will be DELETED from the core_device_stats sql tabel.")
                        print("This process can not be reversed, it is advised to make a backup of your")
                        print("datatabse before starting this process")
                        print("")
                        conf = ""
                        while conf not in ["YES I AM SURE", "no"]:
                            conf = raw_input("Type 'YES I AM SURE' to confirm, 'no' to cancel: ")
                        if conf == "YES I AM SURE":
                            print("Copying the stats")
                            print("This can take some time be patient")
                            db.upgrade_do(selDev['id'], selKey, newDev[(seln - 1)]['id'], newDev[(seln - 1)]["sensors"][selS]["id"])
                            # check if this is the last key
                            if len(old_devs[selDev['id']]['keys']) == 1:
                                print("This was the last key of the device, so deleting the device")
                                db.del_device(selDev['id'])
                            print("Upgrade DONE")
                            print ""
                        else:
                            print("Upgrade CANCELED")

        else:
            do = False
        # close all
        db.close_session()
        if do:
            db.open_session()
开发者ID:Nico0084,项目名称:domogik,代码行数:33,代码来源:statsUpgrade.py


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