Skip to content

Errors ETL #5

Description

@kennyctran

const etlCharacteristicReviews = () => {
const readable = fs.createReadStream(characteristicReviews);
readable
.pipe(csv({}))
.on('data', async (data) => {
let transformedData = [Number(data.id), Number(data.characteristic_id), Number(data.review_id), Number(data.value)];
await db.insertIntoCharacteristicsReviews(transformedData);
})
.on('data', () => {
readable.pause();
setTimeout(() => {
// console.log('Now data starts flowing again.');
readable.resume();
}, 1000);
})
.on('end', () => {
console.log('INSERTED ALL CHARACTERISTICS REVIEWS INTO PHOTOS!!!!!!!!!!!!');
});
}

Make sure we're handling errors within the process. You'll need to handle errors for the stream as well as errors with mongoose

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions