本文整理匯總了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)