本文整理汇总了Python中spendb.model.Dataset.all_by_account方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.all_by_account方法的具体用法?Python Dataset.all_by_account怎么用?Python Dataset.all_by_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spendb.model.Dataset
的用法示例。
在下文中一共展示了Dataset.all_by_account方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_index
# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
def query_index():
q = Dataset.all_by_account(current_user, order=False)
q = q.order_by(Dataset.updated_at.desc())
# Filter by languages if they have been provided
for language in request.args.getlist('languages'):
l = aliased(DatasetLanguage)
q = q.join(l, Dataset._languages)
q = q.filter(l.code == language)
# Filter by territories if they have been provided
for territory in request.args.getlist('territories'):
t = aliased(DatasetTerritory)
q = q.join(t, Dataset._territories)
q = q.filter(t.code == territory)
# Return a list of languages as dicts with code, count, url and label
languages = [{'code': code, 'count': count, 'label': LANGUAGES.get(code)}
for (code, count) in DatasetLanguage.dataset_counts(q)]
territories = [{'code': code, 'count': count, 'label': COUNTRIES.get(code)}
for (code, count) in DatasetTerritory.dataset_counts(q)]
pager = Pager(q, limit=15)
return pager, languages, territories
示例2: list_cubes
# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
def list_cubes(self):
cubes = []
for dataset in Dataset.all_by_account(None):
if not dataset.has_model:
continue
cubes.append({"name": dataset.name, "label": dataset.label})
return cubes
示例3: list_cubes
# 需要导入模块: from spendb.model import Dataset [as 别名]
# 或者: from spendb.model.Dataset import all_by_account [as 别名]
def list_cubes(self):
cubes = []
for dataset in Dataset.all_by_account(None):
if not len(dataset.model.axes):
continue
cubes.append({
'name': dataset.name,
'label': dataset.label
})
return cubes