luka , hello 🙂
import sql_query
import catalogs
(Create a list of fields we want to retrieve)
fields = ["Id", "Email", "Name"]
(GUID of the component)
component = 'cee394d2-64fd-49d0-9221-1068ae010495'
(Get the SQL query as a string)
query_str = sql_query.simple_query(fields, component)
(Create the query)
query = catalogs.query(query_str)
(Execute the query)
item["query_result"] = query.execute()
(Result)
"""
SELECT cmp."Id" as "Id",
cmp."Data_Email" as "Email",
cmp."Data_Name" as "Name"
FROM "cee394d2-64fd-49d0-9221-1068ae010495" as cmp
"""