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


Python Connection.commit方法代码示例

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


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

示例1: run

# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import commit [as 别名]
 def run (self):
     """Run the sql script in sql attribute. Will execute the script and 
     then commit any changes to database. Results of script will be put in
     to table attribute. If testing is true, does nothing.
     """
     if self.testing:
         return
     conn = Connection(self.db, self.host, self.user, self.passwd)
     conn.execute(self.sql)
     self.table = conn.fetch()
     conn.commit()
开发者ID:gina-alaska,项目名称:imiq-database,代码行数:13,代码来源:posthaste.py

示例2: Connection

# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import commit [as 别名]
wconnection = Connection(host=os.environ["POSTGRES_HOST"],
                         dbname=os.environ["POSTGRES_DB"],
                         user=os.environ["POSTGRES_USER"],
                         password=os.environ["POSTGRES_PASS"])

wconnection.connect()

wcursor = wconnection.cursor()

# Create the tables if they don't exist yet.
wcursor.execute(CREATE_PRO_SCHEDULE)
wcursor.execute(CREATE_PRO_SCHEDULE_LOCATION)
wcursor.execute(CREATE_PRO_LATENESS)

wconnection.commit()

# Set the date for which we are processing the data.
DATE = datetime.date(2015, 9, 27)
TDZERO = datetime.timedelta(0, 0)

# Get all the schedules from the database.
rcursor.execute("SELECT rid, uid from schedule where start_date=%s and passenger_service=true and deleted=false and status not in ('B', '5')", (DATE,))

counter = 0
while True:
    row = rcursor.fetchone()
    if row is None:
        break

    counter += 1
开发者ID:grundleborg,项目名称:delay-explorer-aggregator,代码行数:32,代码来源:process.py


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