Custom JdbcSink?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom JdbcSink?

Cecile Kim

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

 

Reply | Threaded
Open this post in threaded view
|

Re: Custom JdbcSink?

Cecile Kim

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 <[hidden email]>
Date: Monday, February 1, 2021 at 2:01 PM
To: [hidden email] <[hidden email]>
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