本文整理匯總了Python中DBManager.DBManager.createDB方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.createDB方法的具體用法?Python DBManager.createDB怎麽用?Python DBManager.createDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.createDB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1:
# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import createDB [as 別名]
config = ConfigParser.ConfigParser()
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']