本文整理汇总了Python中DBManager.DBManager.saveAll方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.saveAll方法的具体用法?Python DBManager.saveAll怎么用?Python DBManager.saveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.saveAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import saveAll [as 别名]
db = conn.createDB()
conn.saveAllViews()
except couchdb.http.ResourceNotFound:
print "Database doesn't exist. We'll go ahead and create it."
db = conn.createDB()
conn.saveAllViews()
else:
db = conn.db
max_num_articles=config.getint('boston_globe','max_num_articles')
articles_at_a_time=config.getint('boston_globe','articles_at_a_time')
size = 0
lastArticleDate=""
results = db.view('globe/last_article_date')
for row in results:
lastArticleDate = row['value']
if (lastArticleDate ==""):
lastArticleDate = "20100101"
while size<max_num_articles:
latestArticles = boston_globe.fetchLatestArticlesFromAPI(size, lastArticleDate)
if (len(latestArticles) ==0):
break
cleanArticles = geoprocessor.filterAndCleanArticles(latestArticles, conn)
conn.saveAll(cleanArticles)
size += articles_at_a_time
print "Done adding articles from the API"