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


Python DBManager.saveAllViews方法代码示例

本文整理汇总了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']
开发者ID:c4fcm,项目名称:Boston-Attention-Mapping,代码行数:32,代码来源:add_articles_from_API.py


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