JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q20476F
  • License MIT

Package Exports

  • sql-csv-insert-processor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sql-csv-insert-processor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Install and use it

Build Status

> npm i sql-csv-insert-processor

Testing sql-csv-insert-processor

const SETUP: ProcessorSetup[] = [
  {
    result_file_name: 'exported/annotations/ann_box',
    laggards_file_name: 'exported/annotations/for_review_ann_box',
    fields: {
      attachment_url: 'image_url_address',
      instructions: 'details',
      with_labels: 'with_labels',
    },
    IS_INSERT_IGNORE: true,
    TABLE_NAME: 'ann_box',
    csv_file_path: './src/assets/Trainingset.ai - box annotation example - demo.csv',
    encoding: 'win1250',
    PreProcessor: [
      /**
       * @param {*} data represents current row data
       * @param {requestCallback} PushToResult Run the function which save the row data into first result file
       * @param {requestCallback} PushToLaggards Run the function which save the row data into first result file
       * @param {[]} currentResultArray Includes the curretly saved data (for results) to be passed to PostProcessor
       * @param {[]} currentLaggardArray Includes the curretly saved data (for laggards) to be passed to PostProcessor
       */
      (data, callbackSaveResult, callbackSaveLaggards, currentResultArray, currentLaggardArray) => {
        console.log(data);

        callbackSaveResult(data);
        callbackSaveLaggards(data);

        /* 
        if (currentResultArray.includes( ... )) {
          ...
         } 
         */

        return data;
      },
    ],
    PostProcessor: [   
      (arrayResult, arrayLaggards) => {
        // YOU CAN CHECK OR EDIT THEM BEFORE BUILDIND FILES

        return [arrayResult, arrayLaggards];
      },
    ],    
  },
];

convert

image-20201121002652998

into this

INSERT IGNORE INTO ann_box (details,image_url_address,with_labels) VALUES
( "Draw a box around each car","https://i.imgur.com/OUyDzS2.jpg","TRUE" )
,( "Draw a box around each car","https://i.imgur.com/OUyDzS2.jpg","TRUE" )
,( "Draw a box around each device 2","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )
,( "Draw a box around each device 3","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )
,( "Draw a box around each device 4","https://i.imgur.com/ZhgjlpU.jpg","TRUE" )