mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-12 17:34:18 +00:00
fix(ingest): handle groupby custom label case (#6456)
fix(ingest): handle groupby custom label case Co-authored-by: Phong Vu <phongvt@meeyland.com> Co-authored-by: Harshal Sheth <hsheth2@gmail.com>
This commit is contained in:
parent
73671de7e7
commit
0eb54c6387
@ -308,6 +308,21 @@ class SupersetSource(Source):
|
|||||||
group_bys = params.get("groupby", []) or []
|
group_bys = params.get("groupby", []) or []
|
||||||
if isinstance(group_bys, str):
|
if isinstance(group_bys, str):
|
||||||
group_bys = [group_bys]
|
group_bys = [group_bys]
|
||||||
|
# handling List[Union[str, dict]] case
|
||||||
|
# a dict containing two keys: sqlExpression and label
|
||||||
|
elif isinstance(group_bys, list) and len(group_bys) != 0:
|
||||||
|
temp_group_bys = []
|
||||||
|
for item in group_bys:
|
||||||
|
# if the item is a custom label
|
||||||
|
if isinstance(item, dict):
|
||||||
|
item_value = item.get("label", "")
|
||||||
|
if item_value != "": temp_group_bys.append(f"{item_value}_custom_label")
|
||||||
|
else: temp_group_bys.append(item)
|
||||||
|
|
||||||
|
# if the item is a string
|
||||||
|
elif isinstance(item, str): temp_group_bys.append(item)
|
||||||
|
|
||||||
|
group_bys = temp_group_bys
|
||||||
|
|
||||||
custom_properties = {
|
custom_properties = {
|
||||||
"Metrics": ", ".join(metrics),
|
"Metrics": ", ".join(metrics),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user