question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running a SQL step after bulk insert into JDBC

See original GitHub issue

Hello,

When using metorikku with a JDBC output, is it possible to add custom SQL after a bulk insert ?

We’d like to run some SQL on the target JDBC to add some indexes on the created tables :

CREATE INDEX … ON …;

First, we thought of adding the « truncate : true » option so that the tables are not dropped but wiped instead, so the indexes would not be deleted at each ingestion.

# job_config.yaml
output:
  jdbc:
    connectionUrl: ****
    options:
      truncate: true

However, this limits the schema evolution : if the schema in the input changes, the job will fail.

I was wondering if it could be possible to keep the default truncate: false, but add some SQL statement (creating indexes) that would be ran after the output is written. This would allow schema evolution while recreating the indexes at each ingestion.

Do you know if there is a way to achieve this with Metorikku ?

I hope the explanation is precise enough. Thank you in advance for your answer !

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lyogevcommented, Feb 23, 2021

I’ve opened this PR for this #414

1reaction
lyogevcommented, Feb 24, 2021

@cyrillay would you mind testing #414 and see if it fits what you need?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using bulk copy with the JDBC driver
The following application demonstrates how to load data using the SQLServerBulkCopy class. In this example, a CSV file is used to copy data ......
Read more >
jdbc - Different ways of performing bulk insert into database ...
Dynamically generate a batch of SQL statements and execute it against the database by making use of native JDBC support. · Construct XML ......
Read more >
Insert bulk JDBC batches into SQL Server, Oracle & Sybase
Are you looking to improve performance of JDBC batch inserts into SQL Server, Oracle, and Sybase? Try DataDirect JDBC Drivers.
Read more >
Batch Inserts Using JDBC Prepared Statements
You then set the parameters using data-type-specific methods on the PreparedStatement object, such as setString() and setInt() . Once your parameters are set, ......
Read more >
Part 8: JDBC Batch Insert with MySQL Example - YouTube
In this video, you will learn how to perform JDBC Batch insert operation with MySQL database using Statement as well as PreparedStatement ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found