Unverified Commit eb3e4d37 authored by Jin Hyuk Chang's avatar Jin Hyuk Chang Committed by GitHub

other: Add Dashboard sample data (#292)

* Add Dashboard sample data

* Update
parent b4c24ef8
......@@ -649,6 +649,9 @@ Transforms string timestamp into int epoch
#### [RemoveFieldTransformer](./databuilder/transformer/remove_field_transformer.py)
Remove fields from the Dict.
#### [GenericTransformer](./databuilder/transformer/generic_transformer.py)
Transforms dictionary based on callback function that user provides.
## List of loader
#### [FsNeo4jCSVLoader](https://github.com/lyft/amundsendatabuilder/blob/master/databuilder/loader/file_system_neo4j_csv_loader.py "FsNeo4jCSVLoader")
......
import logging
from pyhocon import ConfigTree # noqa: F401
from typing import Any, Dict # noqa: F401
from databuilder.transformer.base_transformer import Transformer
CALLBACK_FUNCTION = 'callback_function'
FIELD_NAME = 'field_name'
LOGGER = logging.getLogger(__name__)
class GenericTransformer(Transformer):
"""
A generic transformer that accepts a callback function that transforms the record on specified field.
"""
def init(self, conf):
# type: (ConfigTree) -> None
self._callback_function = conf.get(CALLBACK_FUNCTION)
self._field_name = conf.get_string(FIELD_NAME)
def transform(self, record):
# type: (Dict[str, Any]) -> Dict[str, Any]
for k, v in record.items():
if k == self._field_name:
new_val = self._callback_function(v)
record[k] = new_val
return record
def get_scope(self):
# type: () -> str
return 'transformer.generic'
product,cluster,dashboard_group,dashboard_group_id,dashboard_group_description,dashboard_group_url,dashboard_name,dashboard_id,description,created_timestamp,dashboard_url
mode,gold,test group1,test_group_id_1,test group description 1,http://mode.test_group_id_1.com,test dashboard,test_dashboard_id_1,test dashboard description,1592333799,http://mode.test_group_id_1.com/test_dashboard_id_1
mode,gold,test group1,test_group_id_1,test group description 1_2,http://mode.test_group_id_1.com,test dashboard,test_dashboard_id_1_2,test dashboard description 1_2,1592332799,http://mode.test_group_id_1.com/test_dashboard_id_1_2
mode,gold,test group2,test_group_id_2,test group description 2,http://mode.test_group_id_2.com,test dashboard,test_dashboard_id_2,test dashboard description,1592133799,http://mode.test_group_id_2.com/test_dashboard_id_2
superset,gold,test group3,test_group_id_3,test group description 1,http://mode.test_group_id_3.com,test dashboard,test_dashboard_id_3,test dashboard description,1591333799,http://mode.test_group_id_3.com/test_dashboard_id_3
product,cluster,dashboard_group_id,dashboard_id,execution_id,execution_timestamp,execution_state
mode,gold,test_group_id_1,test_dashboard_id_1,_last_successful_execution,1592351193,success
mode,gold,test_group_id_2,test_dashboard_id_2,_last_successful_execution,1592351210,success
mode,gold,test_group_id_1,test_dashboard_id_1,_last_execution,1593351193,fail
mode,gold,test_group_id_2,test_dashboard_id_2,_last_execution,1594351210,success
\ No newline at end of file
product,cluster,dashboard_group_id,dashboard_id,last_modified_timestamp
mode,gold,test_group_id_1,test_dashboard_id_1,1592351454
mode,gold,test_group_id_2,test_dashboard_id_2,1592311423
\ No newline at end of file
product,cluster,dashboard_group_id,dashboard_id,email
mode,gold,test_group_id_1,test_dashboard_id_1,roald.amundsen@example.org
mode,gold,test_group_id_2,test_dashboard_id_2,buzz@example.org
\ No newline at end of file
product,cluster,dashboard_group_id,dashboard_id,query_name,query_id,url,query_text
mode,gold,test_group_id_1,test_dashboard_id_1,first query,query_1,http://mode.test_group_id_1.com/test_dashboard_id_1/query/query_1,SELECT * FROM foo.bar
mode,gold,test_group_id_2,test_dashboard_id_2,second query,query_2,http://mode.test_group_id_2.com/test_dashboard_id_2/query/query_2,SELECT * FROM bar.foo JOIN foo.bar USING (baz)
\ No newline at end of file
product,cluster,dashboard_group_id,dashboard_id,table_ids
mode,gold,test_group_id_1,test_dashboard_id_1,"hive://gold.test_schema/test_table1"
mode,gold,test_group_id_2,test_dashboard_id_2,"hive://gold.test_schema/test_view1,hive://gold.test_schema/test_table3"
product,cluster,dashboard_group_id,dashboard_id,view_count,email
mode,gold,test_group_id_1,test_dashboard_id_1,100,roald.amundsen@example.org
mode,gold,test_group_id_2,test_dashboard_id_2,2000,chrisc@example.org
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment