{"id":42567,"library":"csv-to-sql","title":"csv-to-sql","description":"A lightweight Node.js library for converting CSV files into SQL INSERT statements. Version 0.1.14 is the latest stable release, updated irregularly. It provides a simple CLI and programmatic API to parse CSV data and generate SQL scripts, with options for table naming and batch processing. Differentiators: minimal dependencies, straightforward output, no database connection required. Suitable for quick data migrations or backups.","status":"active","version":"0.1.14","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install csv-to-sql","lang":"bash","label":"npm"},{"cmd":"yarn add csv-to-sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add csv-to-sql","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; CommonJS require may fail or require default import.","wrong":"const convert = require('csv-to-sql').convert","symbol":"convert","correct":"import { convert } from 'csv-to-sql'"},{"note":"Default export is the main convert function. Using require might give an object with convert property.","wrong":"const csvToSql = require('csv-to-sql')","symbol":"default","correct":"import csvToSql from 'csv-to-sql'"},{"note":"The library does not export other symbols; ensure correct named import.","wrong":"","symbol":"convert","correct":"import { convert } from 'csv-to-sql'"}],"quickstart":{"code":"import { convert } from 'csv-to-sql';\n\nconst csv = `id,name,age\\n1,Alice,30\\n2,Bob,25`;\nconst sql = convert(csv, { table: 'users' });\nconsole.log(sql);\n// Output:\n// INSERT INTO users (id, name, age) VALUES (1, 'Alice', 30);\n// INSERT INTO users (id, name, age) VALUES (2, 'Bob', 25);","lang":"javascript","description":"Converts a CSV string to SQL INSERT statements with a specified table name."},"warnings":[{"fix":"Preprocess CSV to escape single quotes or use a more robust library.","message":"CSV values containing single quotes are not escaped and will break SQL.","severity":"gotcha","affected_versions":"<=0.1.14"},{"fix":"Use programmatic API instead of CLI for stability.","message":"The CLI interface may be removed in future versions without notice.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Manually transform output if needed for different SQL syntax.","message":"Output always uses INSERT INTO statements; no support for other SQL dialects.","severity":"gotcha","affected_versions":"all"},{"fix":"Use dynamic import or ensure ESM environment.","message":"Previous versions used CommonJS; v0.1.0+ switched to ESM only.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.14':18 'api':33 'backup':65 'batch':48 'cli':30 'connect':57 'convert':10 'csv':2,11,36 'csv-to-sql':1 'data':37,62 'databas':56 'depend':52 'differenti':50 'file':12 'generat':39 'insert':15 'irregular':25 'javascript':66 'latest':21 'librari':8 'lightweight':6 'migrat':63 'minim':51 'name':46 'node.js':7 'option':43 'output':54 'pars':35 'process':49 'programmat':32 'provid':27 'quick':61 'releas':23 'requir':58 'script':41 'simpl':29 'sql':4,14,40 'stabl':22 'statement':16 'straightforward':53 'suitabl':59 'tabl':45 'updat':24 'version':17","created_at":"2026-06-05T16:55:36.836374+00:00","updated_at":"2026-06-05T16:55:36.836374+00:00","problems":[{"fix":"Run 'npm install csv-to-sql' and use correct import: import { convert } from 'csv-to-sql'","cause":"Module not installed or wrong import path.","error":"Error: Cannot find module 'csv-to-sql'"},{"fix":"Use dynamic import() or set type: 'module' in package.json.","cause":"Using require() on an ESM-only module in CommonJS.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use import { convert } from 'csv-to-sql'; or import csvToSql from 'csv-to-sql';.","cause":"Wrong import style; destructured incorrectly.","error":"TypeError: convert is not a function"},{"fix":"Ensure CSV is properly formatted with same number of columns per row.","cause":"CSV does not have consistent columns or malformed data.","error":"Error: Invalid CSV format"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"csv-to-sql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}