I want to copy old_db.table data to new_db.table.
I used ActiveRecord::Base.connection.execute(sql)
this method for executing my insertion query. That perfectly insert data to new_db.table . But I want to get the query before actual execution.
sql = "insert into `#{new_db}`.#{table} #{f} (select * from #{old_db}.#{table});"
ActiveRecord::Base.connection.execute(sql)
For example I want print "insert into new_db.table values(value1, value2, value3, ...)" something like this, the row-wise execution of my query. How can I do that?
Aucun commentaire:
Enregistrer un commentaire