

def copy_docs(source_db, target_db, doc_ids):
    '\n    copy docs from source_db to target_db\n    by doc_id\n\n    '
    if (not doc_ids):
        return
    with IterDB(target_db, new_edits=False) as iter_db:
        for doc in iter_docs(source_db, doc_ids, attachments=True):
            doc = _insert_attachments(source_db, doc)
            iter_db.save(doc)
    if iter_db.errors_by_type:
        logging.error('errors bulk saving in copy_docs: {!r}'.format(iter_db.errors_by_type))

dataset/ETHPy150Open dimagi/commcare-hq/corehq/doctypemigrations/continuous_migrate.py copy_docs/original