Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

How to run PQL query in AEP?

Avatar

Level 9

I created a batch audience and would like to evaluate the condition to see how many profiles qualify, mainly to verify that the condition I added is correct. I used the 'Code View' option to review the PQL details. Below is the PQL for my batch audience

 

(select _Subscriptions1 from consents.marketing.email.subscriptions.values() where _Subscriptions1.val in ["y"]) and CHAIN(xEvent, timestamp, [C0: WHAT(_experience.customerJourneyManagement.messageDeliveryfeedback.feedbackStatus in ["sent"] and _experience.customerJourneyManagement.messageExecution.messageID.equals("e77ec89b-b7f0-4e40-bdd9-6e87af00c4f3", false)) WHERE(C0.exists((timestamp occurs <= 1 day before today) or (timestamp occurs today) or (timestamp occurs <= 1 day after today))), C1: WHAT(eventType.equals("web.checkout.confirmation", false)) WHERE(C1.exists((timestamp occurs <= 1 day before today) or (timestamp occurs today) or (timestamp occurs <= 1 day after today)))])

 

I simply tried to execute this Query interface and I got this error 

5:46:30 PM > Initializing connection...
5:46:32 PM > Connection successfully established in 1.963 seconds.
5:46:32 PM > Loading autocomplete for tables and columns...
5:46:34 PM > Autocomplete for tables and columns successfully loaded.
5:46:39 PM > Running query...
5:46:39 PM > Query failed in 0.296 seconds.
5:46:39 PM > ErrorCode: 42601 queryId: 04211295-3849-4241-8857-1c54dca3362e Syntax error encountered. Reason: [line 1:104: mismatched input 'in' expecting {')', 'AND', 'EXCEPT', 'FETCH', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OFFSET', 'OR', 'ORDER', 'UNION', 'MINUS'}]

 

Looks like PQL query can not be executed directly and I tried to convert PQL to SQL using chapGPT but it could not convert it properly. Can anyone tell me what is correct way handle this case?

4 Replies

Avatar

Community Advisor

Hi @Mario248 

To my knowledge, PQL is only supported on API side and you cannot define segments in the UI. Also, APi-created PQL segments cannot be modified in the UI either.

In other words, you will either have to use API tools like Postman or a library the AEPP Python wrapper.

Cheers from Switzerland!


Avatar

Level 9

Thanks for your response. my goal is to run PQL query to see how many profile is going to qualify. Can you tell me what API we should use in postman to run the PQL query ?

Avatar

Level 10

Imho if you write queries you need to use SQL not PQL. What type of audience it would be? I assume batch

https://developer.adobe.com/experience-platform-apis/references/segmentation/#operation/createAudien...

 

Create an audience then wait for next segment job or use flexible audience evaluation 

Avatar

Level 9

Thanks for your response. I am doing exact what you said above.  But I create an audience and wait for next segment job. I dont want to wait for a day to see the query result. I thought there is easy to way to check the query before actual segment job runs.