Skip to main content
Question

Central code management of code for StoredProcedures equivalent.

  • February 10, 2020
  • 1 reply
  • 7 views

MaciejPaliwoda
Forum|alt.badge.img+2

Hi,
Customer has migrated form SQL Server to Vertica. The functionality he is missing a lot is a "Stored Procedures" , allowing end users (non-admin) to execute parametrized SQL query template (that must be managed centraly) and be able to get the result set (i.e. for reporting)....
Customer wants to have this functionality, as query might be very complex , and such queries are too difficult for business users to edit or play with. Also quite often such queries are used by some reports (Qlik), so changing everywhere and keep the proper and same version is difficult.

My idea was to:
1. Create function that accepts desired parameters values (passed as function arguments) , and returns a string being query to be executed (with proper value substitution in predicate section).
2. Grab that string and run as an VERTICA external procedure, that could store returned dataset as temporary table. Temporary table name, that must be unique.... (many users can run the same flow in parallel)

The issue i cans see is how to manage temporary table names....
Is there any other way to fullfil customer's requirement????

Any hints?
Maciej

1 reply

An_kir
Forum|alt.badge.img+2
  • Participating Frequently
  • February 12, 2020

this is a common request! I think we shd log a jira and have it in Vertica at some point.
the workaround wd be to build a simple app between the client and Vertica which wd take the parameters and run a shell script for a sql code stored on the server in a file. or generate a sql script with \set