Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How would you do this in code? If you think about what you are asking it is an incredibly difficult problem to solve, even for someone writing bespoke code by hand. The problems you have are....
1) How do you identify the tables to be backed up and restored? - Possibly there is a simple answer to this like a list of tables in a file or database, or maybe searching the database for tables that have been modified. This would need to be considered in your solution.
2) Are you doing a dump of the entire tables or incremental backups? - If you are intending to dump the whole table, that would be easier. If you want incremental changes, that makes it a lot more complicated.
3) How will you identify the datatypes? - You are dumping to a flat file which makes everything essentially a String. When you want to restore this, you will have to convert from a String to the correct data type. You cannot easily do this dynamically and it would require some bespoke code.
If you want to do this in Talend, you cannot expect to be able to create an export and an import job unless you are intending to use built-in backup and restore functionality of the database you are using. THIS is very possible. However if you want to bypass the built-in backup and restore functionality of your database, you won't be able to do it with 2 jobs very easily at all. It would be easier to create a job per table and dynamically call the relevant jobs depending on what you want to backup and restore.
The easiest way to achieve this is to use the database's built in backup and restore functionality called via Talend. If this is command line based you can use a tSystem component, if it can be run from within the DB environment you can use tDBRow to call whatever statements you need. This can indeed be done with a tLoop and context variables.
Hi All,
Thanks rhall for your reply
I cant use DB build in functionality.so i need to achieve with other components
So can anyone help with the idea to achieve this logic
Thanks,
lmit
There is only one way I could think of to do this and it can't be done with the Open Source version. You would need the subscription version to do this as it comes with the Dynamic schema functionality. I wrote on blog on how to do this between two different databases, you may be able to extrapolate from this....
https://www.talend.com/blog/2019/11/11/migrate-data-between-databases-one-job-using-dynamic-schema/
thanks i will check
Hello,
What are you using as a version of Talend? the Open Studio or Enterprise version (dynamic scheme)?
According to your answer, there is the possibility of making a dynamic backup with multiple sources and multiple columns and with a single Talend job.
But, for restoration, it remains more complex. If you have for example an Id column in all your tables, it is possible with a single job but there too, your data must not be linked (because of the referential integrity).
I can send you a generic job for backup, just give me the type of source and target.
Hello,
You will find attached an example of jobs which allows to extract all the tables in CSV files. And conversely but it is a simple insertion and no integrity control.