本文整理汇总了Python中plenario.models.ShapeMetadata.tablenames方法的典型用法代码示例。如果您正苦于以下问题:Python ShapeMetadata.tablenames方法的具体用法?Python ShapeMetadata.tablenames怎么用?Python ShapeMetadata.tablenames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plenario.models.ShapeMetadata
的用法示例。
在下文中一共展示了ShapeMetadata.tablenames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_shape
# 需要导入模块: from plenario.models import ShapeMetadata [as 别名]
# 或者: from plenario.models.ShapeMetadata import tablenames [as 别名]
def export_shape(dataset_name):
"""Route for /shapes/<shapeset>/ endpoint. Requires a dataset argument
and can apply column specific filters to it.
:param dataset_name: user provided name of target shapeset
:returns: response object result of _export_shape
"""
# Find a way to work these into the validator, they shouldn't be out here.
if dataset_name not in ShapeMetadata.tablenames():
return make_error(dataset_name + ' not found.', 404)
try:
ShapeMetadata.get_by_dataset_name(dataset_name).shape_table
except NoSuchTableError:
return make_error(dataset_name + ' has yet to be ingested.', 404)
meta_params = ('shape', 'data_type', 'location_geom__within', 'job')
request_args = request.args.to_dict()
# Using the 'shape' key triggers the correct validator.
request_args['shape'] = dataset_name
validated_args = validate(
ExportFormatsValidator(only=meta_params),
request_args
)
if validated_args.errors:
return bad_request(validated_args.errors)
elif validated_args.data.get('job'):
return make_job_response('export-shape', validated_args)
else:
query = _export_shape(validated_args)
shapeset = validated_args.data.get('shapeset')
data_type = validated_args.data.get('data_type')
return export_dataset_to_response(shapeset, data_type, query)