How to call / execute a MySQL script

Highlighted
Four Stars

How to call / execute a MySQL script

I've already used a tMySQLRow component to execute several statements (configuring the connection with "allowMultiQueries=true"), but now I have a SQL file with different types of statements:

- Drop tables
- Create tables
- Create indexes
- Function declarations  (set delimiter //     create function xxxx...      set delimiter ; )
- Truncate tables
- Insert into table select ....

There are many statements, and not sure the function declarations that work under mysql console, can be embedded in the tMySQLRow component.

Is there any way or tMySQL component like tMySQLRow able to execute a MySQL script (SQL text file)?

Thanks

Seventeen Stars

Re: How to call / execute a MySQL script

Yes. You can use the component tSQLScriptParser. This component does not run the statements it self but parses a script (also from a file) and iterates through the single statements.
You can use the Iterate flow and e.g. a tMysqlRow to run the statements.
https://exchange.talend.com/#marketplaceproductoverview:gallery=marketplace%252F1&pi=marketplace%252...
There is also a stupid useless copy of my component, only my original version is maintained.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog