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