Skip to main content
Question

How to pass pipeline parameter to jdbc query in streamsets

  • October 25, 2022
  • 5 replies
  • 98 views

I have pipeline parameter name run_id = 123 in configuration and inside jdbc query i want to pass following query:

SELECT * FROM test WHERE id = ${run_id}

 

5 replies

alex.sanchez
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 73 replies
  • October 25, 2022

Hi @la_treb2,

I guess you are using JDBC Query Consumer as origin stage, if that is the case, the way you are doing should be correct.

Are you getting any errors out of that?


  • Author
  • Fan
  • 2 replies
  • October 25, 2022
org.postgresql.util.PSQLException: ERROR: column "de89higjl-2fdf-4a9c-9447-01cacc661e0d" does not exist. Where "de89higjl-2fdf-4a9c-9447-01cacc661e0d" is a value of run_id parameter.

  • Author
  • Fan
  • 2 replies
  • October 25, 2022

The issue was, beacues i have passed run_id in parametr in double quotes but only one quotes is allowed...


alex.sanchez
StreamSets Employee
Forum|alt.badge.img
  • StreamSets Employee
  • 73 replies
  • October 25, 2022

That’s great, thank you for posting the solution too!


Bikram
Headliner
Forum|alt.badge.img+1
  • Headliner
  • 486 replies
  • October 26, 2022

@la_treb2 

 

If run_id  value is a number then we don’t need quote for numbers and if its a string value then we have to put into in single quote.

 

SELECT * FROM test WHERE id = ${run_id}. ( If the run_id is a number)

 

SELECT * FROM test WHERE id = ‘${run_id}’ (If run id is a string)