I’m using OrionSDK and I have a python query that keeps returning this error: mismatched input ‘Orion’ expecting ‘FROM’ . Here is the query. Not sure what can be causing this. Thanks in Advance!
'''results = swis.query("SELECT " "n.Caption AS NodeCaption" ",n.IP_Address AS IPAddress" ",n.NodeID" ",a.ApplicationID" ",n.Uri AS NodeUri" ",n.Uri AS AppUri" "FROM Orion.Nodes n" "JOIN Orion.APM.Application a ON n.NodeID = a.NodeID" "JOIN Orion.APM.ApplicationTemplate at ON a.ApplicationTemplateID = at.ApplicationTemplateID" "WHERE at.Name IN('Process_Monitor - Dynatrace Linux OneAgent', 'Service_Monitor - Dynatrace " "OneAgent Service'") '''
Advertisement
Answer
You need some extra spaces in your query string.
For instance, these two lines:
",n.Uri AS AppUri" "FROM Orion.Nodes n"
will produce:
,n.Uri AS AppUriFROM Orion.Nodes n
So it is parsing “AppUriFROM” as the column alias; then it is expecting a FROM keyword but finding Orion
instead, which causes your error.
I think you need to add a space before the FROM, JOIN, and WHERE keywords.