Ask Your Question
0

JDBC Producer gets syntax error writing to Redshift DB

asked 2017-05-09 13:51:27 -0600

metadaddy gravatar image

updated 2017-05-09 13:55:44 -0600

I’m having an issue reading from a Redshift DB. The initial query works fine and I’m able to ingest over 2M rows from Redshift to another DB. But once that initial read completes and the second one is attempted, I get the following error:

First error: SQLState: 42601 Error Code: 500310 Message: [Amazon](500310) Invalid operation: syntax error at or near "00" Position: 257; Cause: com.amazon.support.exceptions.ErrorException: [Amazon](500310) Invalid operation: syntax error at or near "00" Position: 257;

Enabling debug and looking in sdc.log I can see the query that fails:

SELECT "timestamp", "id" 
FROM pages
WHERE received_at > 2017-01-01 00:02:36.625000
ORDER BY received_at
LIMIT 1000
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2017-05-09 13:55:36 -0600

metadaddy gravatar image

It's complaining because the timestamp needs to be quoted - i.e. your query should be configured:

SELECT "timestamp", "id" 
FROM pages
WHERE received_at > '${OFFSET}'
ORDER BY received_at
LIMIT 1000

The first query is working because you put quotes in the initial offset. Remove quotes from the initial offset, put quotes in the query, and you should be good to go.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-09 13:51:27 -0600

Seen: 508 times

Last updated: May 09 '17