Using Replacement Variable with sql query on workbench

I am trying to use replacement variable with my sql query to append data. I have table in database with about 16 million rows and thus a full replace would not be feasible. I have already referred to KB documentation and my sql query is a select statement with the column name in the where clause as well as order by clause. I have the following mentioned under "Replacement Variable" tab. Column: id and value: !{lastvalue:id}!

I have followed the following steps:

  1. used select statement (SELECT id, name, source, dateAdded FROM tablename)
  2. under the Replacement tab (Column: id and value: !{lastvalue:id}!
  3. Update method Replace.
  4. When I execute this job I am receiving the following message "Replacing last value query parameter at position 1341.

Can someone help me understand what am I missing here.

Best Answer

  • ggenovese
    ggenovese Contributor
    Answer ✓

    it looks like you're not using the replacement variable in your SQL statement it should look like this:

    SELECT id, name, source, dateAdded 
    FROM tablename
    WHERE id > !{lastvalue:id}!
    ORDER BY id ASC
    

    and then make sure to seed your replacement variable with an id that you would like to start importing with, then once it runs successfully your value will be updated with the last value that you imported.

    https://domo-support.domo.com/s/article/360042932734?language=en_US

Answers

  • ggenovese
    ggenovese Contributor
    Answer ✓

    it looks like you're not using the replacement variable in your SQL statement it should look like this:

    SELECT id, name, source, dateAdded 
    FROM tablename
    WHERE id > !{lastvalue:id}!
    ORDER BY id ASC
    

    and then make sure to seed your replacement variable with an id that you would like to start importing with, then once it runs successfully your value will be updated with the last value that you imported.

    https://domo-support.domo.com/s/article/360042932734?language=en_US

  • Thank You! I missed to seed the replacement variable with id. I was able to resolve this issue by adding a value to the replacement variable.