本文整理汇总了Python中DBManager.DBManager.saveAllViews方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.saveAllViews方法的具体用法?Python DBManager.saveAllViews怎么用?Python DBManager.saveAllViews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.saveAllViews方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import saveAllViews [as 别名]
config.read(APP_ROOT_DIR + 'python/globe.config')
#parse command line args
parser.add_argument("-d","--delete", action="store_true", default=False, help="delete the existing database and download all new data from the API")
args = parser.parse_args()
if(args.delete):
print 'You have specified delete so I will delete and re-create the database'
#delete DB if it exists & they told us to
if (args.delete):
try:
conn.deleteDB()
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']