cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DQL query to combine multiple fetches

rchillara
Frequent Guest

Hi, 

What is the syntax to create a union of two fetch statmenents, bascially wanted a result of both fetch queires in a single statement

fetch `dt.entity.palo-alto:device`
| fieldsAdd SystemName,deviceAddress,entity.type
| fieldsRename ipaddress=deviceAddress,devicename=SystemName,type=entity.type

 fetch `dt.entity.snmp:com_dynatrace_extension_snmp_generic_cisco_device`
| fieldsAdd system_name,dt.ip_addresses,entity.type
| fieldsRename ipaddress=dt.ip_addresses,devicename=system_name,type=entity.type

Appreciate your response.

Thanks & Regards,

Rama

2 REPLIES 2

stefan_eggersto
Dynatrace Mentor
Dynatrace Mentor

Hi @rchillara ,

the DQL equivalent for SQL union is the append command. The following query should work:

fetch `dt.entity.palo-alto:device`
| fieldsAdd SystemName,deviceAddress,entity.type
| fieldsRename ipaddress=deviceAddress,devicename=SystemName,type=entity.type
| append [
  fetch `dt.entity.snmp:com_dynatrace_extension_snmp_generic_cisco_device`
| fieldsAdd system_name,dt.ip_addresses,entity.type
| fieldsRename ipaddress=dt.ip_addresses,devicename=system_name,type=entity.type
]

 

@stefan_eggersto thank you. 

Featured Posts