You can use INSERT IGNORE INTO mysql query with the help of insertFromSelect() method in Magento 2 with use of magento best standard in your module.
This Magento 2 script by AquiveMedia automates importing databases from remote servers via SSH with configurable environment settings. It supports table exclusions and compression, making it ideal for efficient, tailored migrations.