How to call or execute(take as data-source) an SQL stored procedure in pyramid analytics
hi all,
I was trying to call an SQL stored procedure from custom query into pyramid analytics in below way.
exec dbo.[Get_SalesdetailsPyramid]
The statement is valid, but I have error while dragging the fileds in Discovery. Error is as below:
Failed run SQL query in model source. model: 3850ba93-dfc6-4926-b394-8f995f8cbe2b|OPTM|06b35dad-20aa-428d-8baa-ba995dcdb61d|, query: WITH [_sp1_] as (exec dbo.[Get_SalesdetailsPyramid])
SELECT TOP 20000001 [_sp1_].[Country] [_sp1___Country_]
FROM [_sp1_] [_sp1_]
GROUP BY [_sp1_].[Country]
ORDER BY [_sp1_].[Country] ASC
Pyramid Version:2020.00.055
message:Incorrect syntax near the keyword 'exec'.
Can any one please help whether i can call stored procedure in pyramid analytics, if yes how can i call it??
thanx in advance..
4 replies
-
You cannot currently call a stored procedure as a live data-set from Pyramid. Instead you can use the Model tools to ingest results from the stored procedure into another data model. Alternatively, use views as the source - then it can be queried live.
-
Hi Avi Perez,
Thanx for the reply. Can you please explain this: "Instead you can use the Model tools to ingest results from the stored procedure into another data model."
-
Hi Srilakshmi,
The data discovery doesn't know how to work with stored procedures (or exec commands).
Avi suggest a different solution - use the ETL to execute the store procedure, and store the results on a different database on a regular table, and then use the data discovery.
in the attachment you can find a small example of that process.
Let me know if you need any additional help,
Shai.