cancel
Showing results for 
Search instead for 
Did you mean: 

Issues building a query passing A parameter syntax

lprais
New Contributor

I know this is a very simple solution however I connect figure out the syntax in SL. I can pass this in a stored procedure on redship but when building it in my Pipeline using the Redshift execute it will not work and getting syntax error

It appears that it is trying to put the first part of the email as a column

Simple SQL

Select * from Snaplogic_space.SFDC_Leads_vw where SFDC_Leads_vw.email = ‘phubley@utahfilmcenter.org’

Snaplogic SQL pass Value form email above to a parameter
“SELECT *
FROM Snaplogic_space.SFDC_Leads_vw
WHERE SFDC_Leads_vw.email ==” + $Email + “”

Where $Email has a value of phubley@utahfilmcenter.org

Syntax Error
SettingsAccountViewsInfo
Label*
Redshift - Execute1
SQL statement*=
“SELECT *
FROM Snaplogic_space.SFDC_Leads_vw
WHERE SFDC_Leads_vw.email =” + $Email +“”
Pass through
Ignore empty result
Auto commit
Execute during preview
Failure: Failed to execute query: SELECT * FROM Snaplogic_space.SFDC_Leads_vw WHERE SFDC_Leads_vw.email =phubley@utahfilmcenter.org, Reason: Amazon Invalid operation: column “phubley” does not exist in sfdc_leads_vw;, Resolution: Please check sql query.

this seems so simple cannot figure out what I am doing wrong

3 REPLIES 3

lprais
New Contributor

I figured it out

“SELECT *
FROM Snaplogic_space.SFDC_Leads_vw
WHERE email ='” + $Email + “'”

If anyone was wondering. Just tired and forgot the single " ’ "

tstack
Former Employee

You should not have to make the SQL statement an expression in the snap, the following should directly work:

SELECT * FROM Snaplogic_space.SFDC_Leads_vw WHERE SFDC_Leads_vw.email = $Email

The snap will turn any property references (e.g. $Email) in the statement into a bound parameter when preparing the SQL statement.

lprais
New Contributor

Thank you very much that worked perfect