You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Cecile Kim <ck...@beyond.ai> on 2021/02/01 22:00:45 UTC

Custom JdbcSink?

Hi,

I would like to override the JdbcSink, so that, given one record, it adds N insert SQL statements to the batch, where N is equal to a length computed by the given record. To do this, I need to override JdbcBatchingOutputFormat.writeRecord(), so that I can adjust how batchCount is incremented. Not sure what the implications are of going over the batch size configured in JdbcExecutionOptions (default 5000). However,  JdbcBatchingOutputFormat  doesn’t seem like it was designed to be overridden, because it uses some internal classes, such as JdbcExec. Is there a way to do what I want to do?

Thank you,
Cecile


Re: Custom JdbcSink?

Posted by Cecile Kim <ck...@beyond.ai>.
Nevermind! I realized I was just misreading the code. I can override the class. JdbcExec is just a generic, duh 😊

Thank you,
Cecile

From: Cecile Kim <ck...@beyond.ai>
Date: Monday, February 1, 2021 at 2:01 PM
To: user@flink.apache.org <us...@flink.apache.org>
Subject: Custom JdbcSink?
Hi,

I would like to override the JdbcSink, so that, given one record, it adds N insert SQL statements to the batch, where N is equal to a length computed by the given record. To do this, I need to override JdbcBatchingOutputFormat.writeRecord(), so that I can adjust how batchCount is incremented. Not sure what the implications are of going over the batch size configured in JdbcExecutionOptions (default 5000). However,  JdbcBatchingOutputFormat  doesn’t seem like it was designed to be overridden, because it uses some internal classes, such as JdbcExec. Is there a way to do what I want to do?

Thank you,
Cecile