{"library":"sql-parse","title":"SQL Parsing Utility","type":"library","description":"`sql-parse` is an unmaintained JavaScript utility for parsing basic SQL queries, with its last known stable version being 0.1.5, published in June 2015. It was designed to provide a simple programmatic interface for tokenizing and parsing SQL strings, extracting components like `SELECT` statements and `WHERE` clauses, including initial support for `OR` operators. Due to its age and lack of maintenance for nearly a decade, it is considered abandoned. Modern SQL dialects, advanced query features, and contemporary JavaScript module systems (ESM) are not supported. Developers seeking robust, actively maintained SQL parsing solutions for diverse database systems (e.g., MySQL, PostgreSQL, BigQuery, Snowflake, FlinkSQL) should consider alternatives like `node-sql-parser`, `dt-sql-parser`, or `@casual-simulation/sql-parser`. Its release cadence was sporadic and ceased many years ago. It lacks official TypeScript types and has no external runtime dependencies.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install sql-parse"],"cli":null},"imports":["const { parse } = require('sql-parse');","const sqlParse = require('sql-parse');"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/sql-parse","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const { parse } = require('sql-parse');\n\nconst simpleSelect = 'SELECT id, name FROM users WHERE active = true OR age > 30;';\nconst insertStatement = 'INSERT INTO products (name, price) VALUES (\"Laptop\", 1200.00);';\nconst updateStatement = 'UPDATE orders SET status = \"shipped\" WHERE id = 101;';\n\ntry {\n  const resultSelect = parse(simpleSelect);\n  console.log('Parsed SELECT:', JSON.stringify(resultSelect, null, 2));\n\n  // Note: The specific structure of `result` depends entirely on the library's implementation.\n  // Given its age, it might be a simple object or array of tokens/nodes.\n  // This example assumes a structure that might expose `statements` or similar.\n  if (resultSelect && Array.isArray(resultSelect.statements) && resultSelect.statements.length > 0) {\n    console.log('First statement type:', resultSelect.statements[0].type); // e.g., 'SELECT'\n  } else {\n    console.log('Could not determine statement type for SELECT.');\n  }\n\n  // Trying other statement types might fail or yield unexpected results\n  // as the README primarily focuses on SELECT queries.\n  // const resultInsert = parse(insertStatement);\n  // console.log('Parsed INSERT:', JSON.stringify(resultInsert, null, 2));\n\n} catch (error) {\n  console.error('SQL Parsing Error:', error.message);\n  console.warn('This package is very old and may not support modern or complex SQL syntax.');\n}","lang":"javascript","description":"Demonstrates importing and using the `parse` function to process a basic SQL `SELECT` statement in a CommonJS environment. It also highlights potential issues with unsupported syntax due to the package's age.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}