Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'indexed_by': NativeField(
'indexed_by',
'User who indexed the dataset',
DATASET.c.added_by
),
'product': NativeField(
'product',
'Product name',
PRODUCT.c.name
),
'dataset_type_id': NativeField(
'dataset_type_id',
'ID of a dataset type',
DATASET.c.dataset_type_ref
),
'metadata_type': NativeField(
'metadata_type',
'Metadata type name of dataset',
METADATA_TYPE.c.name
),
'metadata_type_id': NativeField(
'metadata_type_id',
'ID of a metadata type',
DATASET.c.metadata_type_ref
),
'metadata_doc': NativeField(
'metadata_doc',
'Full metadata document',
DATASET.c.metadata
),
# Fields that can affect row selection
'dataset_type_id': NativeField(
'dataset_type_id',
'ID of a dataset type',
DATASET.c.dataset_type_ref
),
'metadata_type': NativeField(
'metadata_type',
'Metadata type name of dataset',
METADATA_TYPE.c.name
),
'metadata_type_id': NativeField(
'metadata_type_id',
'ID of a metadata type',
DATASET.c.metadata_type_ref
),
'metadata_doc': NativeField(
'metadata_doc',
'Full metadata document',
DATASET.c.metadata
),
# Fields that can affect row selection
# Note that this field is a single uri: selecting it will result in one-result per uri.
# (ie. duplicate datasets if multiple uris, no dataset if no uris)
'uri': NativeField(
'uri',
"Dataset URI",
DATASET_LOCATION.c.uri_body,
alchemy_expression=_dataset_uri_field(DATASET_LOCATION),
affects_row_selection=True
),
}
def __init__(self, name, description, alchemy_column, alchemy_expression=None,
# Should this be selected by default when selecting all fields?
affects_row_selection=False):
super(NativeField, self).__init__(name, description, alchemy_column, False)
self._expression = alchemy_expression
self.affects_row_selection = affects_row_selection
'indexed_time': NativeField(
'indexed_time',
'When dataset was indexed',
DATASET.c.added
),
'indexed_by': NativeField(
'indexed_by',
'User who indexed the dataset',
DATASET.c.added_by
),
'product': NativeField(
'product',
'Product name',
PRODUCT.c.name
),
'dataset_type_id': NativeField(
'dataset_type_id',
'ID of a dataset type',
DATASET.c.dataset_type_ref
),
'metadata_type': NativeField(
'metadata_type',
'Metadata type name of dataset',
METADATA_TYPE.c.name
),
'metadata_type_id': NativeField(
'metadata_type_id',
'ID of a metadata type',
DATASET.c.metadata_type_ref
),
'metadata_doc': NativeField(
'metadata_doc',
def day(self):
"""Get field truncated to the day"""
return NativeField(
'{}_day'.format(self.name),
'Day of {}'.format(self.description),
self.alchemy_column,
alchemy_expression=cast(func.date_trunc('day', self.alchemy_expression), postgres.TIMESTAMP)
)
'id': NativeField(
'id',
'Dataset UUID',
DATASET.c.id
),
'indexed_time': NativeField(
'indexed_time',
'When dataset was indexed',
DATASET.c.added
),
'indexed_by': NativeField(
'indexed_by',
'User who indexed the dataset',
DATASET.c.added_by
),
'product': NativeField(
'product',
'Product name',
PRODUCT.c.name
),
'dataset_type_id': NativeField(
'dataset_type_id',
'ID of a dataset type',
DATASET.c.dataset_type_ref
),
'metadata_type': NativeField(
'metadata_type',
'Metadata type name of dataset',
METADATA_TYPE.c.name
),
'metadata_type_id': NativeField(
'metadata_type_id',
),
'metadata_type_id': NativeField(
'metadata_type_id',
'ID of a metadata type',
DATASET.c.metadata_type_ref
),
'metadata_doc': NativeField(
'metadata_doc',
'Full metadata document',
DATASET.c.metadata
),
# Fields that can affect row selection
# Note that this field is a single uri: selecting it will result in one-result per uri.
# (ie. duplicate datasets if multiple uris, no dataset if no uris)
'uri': NativeField(
'uri',
"Dataset URI",
DATASET_LOCATION.c.uri_body,
alchemy_expression=_dataset_uri_field(DATASET_LOCATION),
affects_row_selection=True
),
}
return fields