|
5 | 5 | import urllib.parse
|
6 | 6 |
|
7 | 7 | from dataclasses import dataclass
|
| 8 | +from marshmallow import EXCLUDE |
8 | 9 | from typing import Any, Dict, List
|
9 | 10 |
|
10 | 11 | from amundsen_common.models.dashboard import DashboardSummary, DashboardSummarySchema
|
@@ -46,10 +47,9 @@ def marshall_table_partial(table_dict: Dict) -> Dict:
|
46 | 47 |
|
47 | 48 | TODO - Unify data format returned by search and metadata.
|
48 | 49 | """
|
49 |
| - schema = PopularTableSchema(strict=True) |
50 |
| - # TODO: consider migrating to validate() instead of roundtripping |
51 |
| - table: PopularTable = schema.load(table_dict).data |
52 |
| - results = schema.dump(table).data |
| 50 | + schema = PopularTableSchema() |
| 51 | + table: PopularTable = schema.load(table_dict, unknown=EXCLUDE) |
| 52 | + results = schema.dump(table) |
53 | 53 | # TODO: fix popular tables to provide these? remove if we're not using them?
|
54 | 54 | # TODO: Add the 'key' or 'id' to the base PopularTableSchema
|
55 | 55 | results['key'] = f'{table.database}://{table.cluster}.{table.schema}/{table.name}'
|
@@ -104,10 +104,9 @@ def marshall_table_full(table_dict: Dict) -> Dict:
|
104 | 104 | :return: Table Dict with sanitized fields
|
105 | 105 | """
|
106 | 106 |
|
107 |
| - schema = TableSchema(strict=True) |
108 |
| - # TODO: consider migrating to validate() instead of roundtripping |
109 |
| - table: Table = schema.load(table_dict).data |
110 |
| - results: Dict[str, Any] = schema.dump(table).data |
| 107 | + schema = TableSchema() |
| 108 | + table: Table = schema.load(table_dict) |
| 109 | + results: Dict[str, Any] = schema.dump(table) |
111 | 110 |
|
112 | 111 | is_editable = is_table_editable(results['schema'], results['name'])
|
113 | 112 | results['is_editable'] = is_editable
|
@@ -149,9 +148,9 @@ def marshall_dashboard_partial(dashboard_dict: Dict) -> Dict:
|
149 | 148 | :param dashboard_dict: Dict of partial dashboard metadata
|
150 | 149 | :return: partial dashboard Dict
|
151 | 150 | """
|
152 |
| - schema = DashboardSummarySchema(strict=True) |
153 |
| - dashboard: DashboardSummary = schema.load(dashboard_dict).data |
154 |
| - results = schema.dump(dashboard).data |
| 151 | + schema = DashboardSummarySchema(unknown=EXCLUDE) |
| 152 | + dashboard: DashboardSummary = schema.load(dashboard_dict) |
| 153 | + results = schema.dump(dashboard) |
155 | 154 | results['type'] = 'dashboard'
|
156 | 155 | # TODO: Bookmark logic relies on key, opting to add this here to avoid messy logic in
|
157 | 156 | # React app and we have to clean up later.
|
|
0 commit comments