mysql dump/export

Highlighted
One Star

mysql dump/export

Before each running of my job I wish to make a mysql backup to a file of the effected tables. Is this possible with one of the available components?
Highlighted
Community Manager

Re: mysql dump/export

Hello
You can use the tMysqlRow component which is used to execute sql statement.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

Re: mysql dump/export

what about using mysqldump command to dump a number of tables?
we have over 20 tables that we want to transfer between database servers using a taldend job, and going table by table is going to be crazy.
Highlighted
Six Stars

Re: mysql dump/export

Hello
What you can do is sometihing like: mysqldump -u -p mydatabase table1 > table1.sql, you can do one command for each command you want.
Highlighted
One Star

Re: mysql dump/export

Hello
What you can do is sometihing like: mysqldump -u -p mydatabase table1 > table1.sql, you can do one command for each command you want.

which component should i use for that? tsystem?
Highlighted
One Star

Re: mysql dump/export

which component should i use for that? tsystem?

Correct, or SSH
Highlighted
Five Stars

Re: mysql dump/export

I had a mysqldump statement working fine in a tSSH component and I wanted to migrate it to a tsystem as the dump need to be done on the same machine (it saved my to manage login and password for the tSSH).
So I've been cut and past the code from tSSH to tSystem using Single Command. The code is (I've all my context variable set up properly)
"mysqldump -u " context.Login " -p" context.Password " --databases " context.dbname " > /home/" context.source "/Archive/" TalendDate.getDate("YYYYMMDD_hhmmss") "_" context.source ".sql"

Then in the standard output I've the following choices:
- to console: print the command on screen but doesn't run it (useful to check that variable are properly used but doesn't do the job)
- to global variable: data is passed on to an output variable linked to the tSystem component. Not really what I want to do
- to console and to global variable: same comment as previously
- normal: data is passed on to the component that comes next, so I plug a tFileDelimited after and it wrote the mysqldump statement instead of the proper dump
So I guess I am missing something, thanks for your help.

tSystem documentation page:
https://help.talend.com/search/all?query=tSystem&content-lang=en
Highlighted
Community Manager

Re: mysql dump/export

Hi magdmartin
Export the Error output to the console, it will print the error on the console if it has error when executing this SQL. From your command, I see the only place in question is the date pattern for the method TalendDate.getDate(), it should be:
TalendDate.getDate("yyyyMMdd_hhmmss") or TalendDate.getDate("yyyyMMdd_HHmmss")
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

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