diff --git a/common/amundsen_common/models/index_map.py b/common/amundsen_common/models/index_map.py index 4deeba243c..0b260840b1 100644 --- a/common/amundsen_common/models/index_map.py +++ b/common/amundsen_common/models/index_map.py @@ -104,7 +104,16 @@ "programmatic_descriptions": { "type": "text", "analyzer": "simple" - } + }, + "update_frequency": { + "type": "text", + "analyzer": "simple", + "fields": { + "raw": { + "type": "keyword" + } + } + }, } } } diff --git a/common/amundsen_common/models/table.py b/common/amundsen_common/models/table.py index f597eee81f..81c8c6d245 100644 --- a/common/amundsen_common/models/table.py +++ b/common/amundsen_common/models/table.py @@ -208,6 +208,7 @@ class Table: sources: Optional[List[Source]] = None is_view: Optional[bool] = attr.ib(default=None, converter=default_if_none) programmatic_descriptions: List[ProgrammaticDescription] = [] + update_frequency: Optional[str] = None common_joins: Optional[List[SqlJoin]] = None common_filters: Optional[List[SqlWhere]] = None diff --git a/common/setup.py b/common/setup.py index 7cbc4111ac..a8273b1179 100644 --- a/common/setup.py +++ b/common/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages, setup -__version__ = '0.31.0+foodtruck.2' +__version__ = '0.31.0+foodtruck.3' requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements-dev.txt') diff --git a/databuilder/databuilder/models/table_elasticsearch_document.py b/databuilder/databuilder/models/table_elasticsearch_document.py index 1f35335764..57ca51f005 100644 --- a/databuilder/databuilder/models/table_elasticsearch_document.py +++ b/databuilder/databuilder/models/table_elasticsearch_document.py @@ -27,7 +27,7 @@ def __init__(self, badges: Optional[List[str]] = None, display_name: Optional[str] = None, schema_description: Optional[str] = None, - programmatic_descriptions: List[str] = [], + programmatic_descriptions: List[str] = [] ) -> None: self.database = database self.cluster = cluster diff --git a/databuilder/databuilder/models/table_update_frequency.py b/databuilder/databuilder/models/table_update_frequency.py index d77442c65a..7d5157b8ac 100644 --- a/databuilder/databuilder/models/table_update_frequency.py +++ b/databuilder/databuilder/models/table_update_frequency.py @@ -14,6 +14,8 @@ class UpdateFrequency(Enum): + ANNUALLY = "annually" + QUARTERLY = "quarterly" MONTHLY = "monthly" WEEKLY = "weekly" DAILY = "daily" diff --git a/frontend/amundsen_application/api/utils/metadata_utils.py b/frontend/amundsen_application/api/utils/metadata_utils.py index 02fa41490d..2644ddd02b 100644 --- a/frontend/amundsen_application/api/utils/metadata_utils.py +++ b/frontend/amundsen_application/api/utils/metadata_utils.py @@ -140,6 +140,9 @@ def marshall_table_full(table_dict: Dict) -> Dict: prog_descriptions = results['programmatic_descriptions'] results['programmatic_descriptions'] = _convert_prog_descriptions(prog_descriptions) + update_frequency = results['update_frequency'] + results['update_frequency'] = update_frequency + columns = results['columns'] for col in columns: # Set column key to guarantee it is available on the frontend diff --git a/frontend/amundsen_application/static/js/config/index.spec.ts b/frontend/amundsen_application/static/js/config/index.spec.ts index a0c88c492e..e429551def 100644 --- a/frontend/amundsen_application/static/js/config/index.spec.ts +++ b/frontend/amundsen_application/static/js/config/index.spec.ts @@ -979,6 +979,7 @@ describe('generateExploreUrl', () => { resource_reports: [], watermarks: [], programmatic_descriptions: {}, + update_frequency: null }; it('calls `exploreUrlGenerator` with table metadata', () => { @@ -1136,6 +1137,7 @@ describe('getColumnLineageLink', () => { resource_reports: [], watermarks: [], programmatic_descriptions: {}, + update_frequency: null }; const columnName = 'column_name'; const actual = ConfigUtils.getColumnLineageLink(tableData, columnName); diff --git a/frontend/amundsen_application/static/js/ducks/tableMetadata/reducer.ts b/frontend/amundsen_application/static/js/ducks/tableMetadata/reducer.ts index ba906c2e51..02489a390f 100644 --- a/frontend/amundsen_application/static/js/ducks/tableMetadata/reducer.ts +++ b/frontend/amundsen_application/static/js/ducks/tableMetadata/reducer.ts @@ -72,6 +72,7 @@ export const initialTableDataState: TableMetadata = { resource_reports: [], watermarks: [], programmatic_descriptions: {}, + update_frequency: null }; export const emptyQualityChecks = { diff --git a/frontend/amundsen_application/static/js/fixtures/globalState.ts b/frontend/amundsen_application/static/js/fixtures/globalState.ts index ea7220a167..ec572ca46a 100644 --- a/frontend/amundsen_application/static/js/fixtures/globalState.ts +++ b/frontend/amundsen_application/static/js/fixtures/globalState.ts @@ -261,6 +261,7 @@ const globalState: GlobalState = { resource_reports: [], watermarks: [], programmatic_descriptions: {}, + update_frequency: null }, tableOwners: { isLoading: true, diff --git a/frontend/amundsen_application/static/js/fixtures/metadata/table.ts b/frontend/amundsen_application/static/js/fixtures/metadata/table.ts index ebac591a1e..b501ca3f8a 100644 --- a/frontend/amundsen_application/static/js/fixtures/metadata/table.ts +++ b/frontend/amundsen_application/static/js/fixtures/metadata/table.ts @@ -117,6 +117,7 @@ export const tableMetadata: TableMetadata = { value: '2020-03-05', }, programmatic_descriptions: {}, + update_frequency: null, schema: 'base', sources: [{ source: diff --git a/frontend/amundsen_application/static/js/interfaces/TableMetadata.ts b/frontend/amundsen_application/static/js/interfaces/TableMetadata.ts index 4dd5a64297..2a94ecd621 100644 --- a/frontend/amundsen_application/static/js/interfaces/TableMetadata.ts +++ b/frontend/amundsen_application/static/js/interfaces/TableMetadata.ts @@ -115,6 +115,7 @@ export interface TableMetadata { resource_reports: ResourceReport[]; watermarks: Watermark[]; programmatic_descriptions: TableProgrammaticDescriptions; + update_frequency?: string | null; } export interface UpdateOwnerPayload { diff --git a/frontend/amundsen_application/static/js/pages/TableDetailPage/index.tsx b/frontend/amundsen_application/static/js/pages/TableDetailPage/index.tsx index fccb7bd9bb..c01c9ad596 100644 --- a/frontend/amundsen_application/static/js/pages/TableDetailPage/index.tsx +++ b/frontend/amundsen_application/static/js/pages/TableDetailPage/index.tsx @@ -602,7 +602,7 @@ export class TableDetail extends React.Component< ) : ( `Snowflake Shares` ); - + tabInfo.push({ content: ( {previewEnabled() && ( - )} + )} @@ -841,7 +841,11 @@ export class TableDetail extends React.Component< {!!data.last_updated_timestamp && (
- {Constants.LAST_UPDATED_TITLE} + { + data.update_frequency != null + ? `${Constants.LAST_UPDATED_TITLE} (${data.update_frequency})` + : Constants.LAST_UPDATED_TITLE + }