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


Python DBSession.execute方法代码示例

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


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

示例1: start

# 需要导入模块: from database import DBSession [as 别名]
# 或者: from database.DBSession import execute [as 别名]
 def start(self):
     db_session = DBSession()
     for sql in sql_statements:
         try:
             db_session.execute(sql)
         except:
             pass
开发者ID:anushreejangid,项目名称:csm,代码行数:9,代码来源:migrate_to_version_4.py

示例2: apply_dialect_specific_codes

# 需要导入模块: from database import DBSession [as 别名]
# 或者: from database.DBSession import execute [as 别名]
def apply_dialect_specific_codes():
    """
    Apply database engine specific codes.  Unlike schema migration codes, these codes are applied to
    new CSM installation which does not require schema migration.
    """
    db_session = DBSession()

    # For MYSQL: MEDIUMTEXT stores 2^24 characters. TEXT (65535) type is not enough when working with NCS6K
    # Multi-Chassis which has twice as much information as a single chassis.
    try:
        db_session.execute('alter table host_context modify data MEDIUMTEXT')
        db_session.execute('alter table conformance_report modify hostnames MEDIUMTEXT')
    except Exception:
        pass
开发者ID:smjurcak,项目名称:csm,代码行数:16,代码来源:initialize.py

示例3: start

# 需要导入模块: from database import DBSession [as 别名]
# 或者: from database.DBSession import execute [as 别名]
    def start(self):
        db_session = DBSession()
        for sql in sql_statements:
            try:
                db_session.execute(sql)
            except Exception as e:
                pass

        try:
            # Re-discover all software inventory for all hosts due to changes in Condoor
            inventory_jobs = db_session.query(InventoryJob)
            for inventory_job in inventory_jobs:
                inventory_job.request_update = True

            db_session.commit()
        except Exception as e:
            pass
开发者ID:smjurcak,项目名称:csm,代码行数:19,代码来源:migrate_to_version_5.py

示例4: start

# 需要导入模块: from database import DBSession [as 别名]
# 或者: from database.DBSession import execute [as 别名]
    def start(self):
        db_session = DBSession()
        for sql in sql_statements:
            try:
                db_session.execute(sql)
            except:
                pass

        try:
            # Creates a context for existing hosts
            hosts = db_session.query(Host).all()
            for host in hosts:
                host.context.append(HostContext())
                if len(host.connection_param) > 0:
                    connection = host.connection_param[0]
                    if connection.port_number is None:
                        connection.port_number = ''
            db_session.commit()
        except:
            pass
开发者ID:anushreejangid,项目名称:csm,代码行数:22,代码来源:migrate_to_version_3.py

示例5: start

# 需要导入模块: from database import DBSession [as 别名]
# 或者: from database.DBSession import execute [as 别名]
 def start(self):
     try:
         db_session = DBSession()
         db_session.execute('alter table system_option add base_url VARCHAR(100)')
     except:
         pass 
开发者ID:ponnadarahul,项目名称:csm,代码行数:8,代码来源:migrate_to_version_1.py


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