Subscribe
Accepted Solution

Use a constant in a SQL Query

I have a User Input Variable that shows a list of snapshots for a volume based off of a SQL query.  I also have defined a Constant that contains the name of the volume we need a list of snapshots for.  I am using a Constant because the end user should not be able to select another volume.  How can i reference the constant in the SQL Query?  I can reference a User Input Variable using the following, but how to I reference the constant?

SELECT snapshot.name

FROM storage.snapshot, storage.volume

WHERE

          volume_id = volume.id

          AND volume.name = ${source_volume}

I want to put a contant in place for ${source_volume}.  I know i could just do 'myVolumeName' but I'd rather reference my already defined constant

Thanks

Sean

Re: Use a constant in a SQL Query

Hi Sean,

Currently, it is not possible for the SQL query to reference the constant defined in the workflow.

For the scenario mentioned above, can you have a different user input like $Volume which is defined with the default value as the volume name that you would like

or as a locked Enum which has just one enum value (the hard-coded name of the volume). You could show  that in the workflow and then the snapshot query can reference the volume name like above. Will that work for you ?

Thanks,

Shailaja