Export as SQL updates, how to format?


I want to export data, as sql updates, from a source db, and run the updates on a target db

To do this, I write a select, and then click the export as  sql updates selection, but, I want to format the resulting export to update by path, and not id, for example

UPDATE core_config_data SET scope = 'default', scope_id = 0, path = 'some/path', value = 'some_value', updated_at = '2021-05-26 05:55:52' WHERE config_id = 1111;

Instead of "WHERE config_id = 1111;" I'd like to have it WHERE path = ..

How do I do that?

The long way I did this was with an SQL query like below

concat('UPDATE core_config_data SET value = \'', c.value, '\' WHERE path = \'', c.path, '\'') as `update_statement`,
from core_config_data c
where c.path like '%string_to_match%'

Is there a way I can do this with DataGrip?

Yuriy Vinogradov

in WHERE clause of this extractor primary key column is used as row identification and it can not be changed. if there is no primary key defined in table - there will not be 'WHERE',


you can create feature request on our tracker to add an ability to select custom column for WHERE clause in this extractor.


This is not a good answer, because - I'm not sure if you see the problem? I am taking data, from one table in DB A, and want to update data in the same table in DB B - surely, you can imagine, that those keys will not be the same, but the paths will? Why do I feel concern that I need to explain that to you?


Please sign in to leave a comment.