{"id":13847418,"url":"https://github.com/modeldba/sql-surveyor","last_synced_at":"2026-03-09T04:32:45.274Z","repository":{"id":39696176,"uuid":"306141569","full_name":"modeldba/sql-surveyor","owner":"modeldba","description":"High-level SQL parser. Identify tables, columns, aliases and more from your SQL script in one easy to consume object. Supports PostgreSQL, MySQL, SQL Server and Oracle (PL/SQL) dialects.","archived":false,"fork":false,"pushed_at":"2023-03-05T14:34:17.000Z","size":14489,"stargazers_count":28,"open_issues_count":10,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-22T02:59:38.190Z","etag":null,"topics":["mssql","mysql","parser","plpgsql","plsql","sql","tsql"],"latest_commit_sha":null,"homepage":"https://modeldba.com/sql-surveyor","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modeldba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-10-21T20:35:47.000Z","updated_at":"2025-09-08T11:08:11.000Z","dependencies_parsed_at":"2024-01-15T21:00:14.503Z","dependency_job_id":null,"html_url":"https://github.com/modeldba/sql-surveyor","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":0.03508771929824561,"last_synced_commit":"8f1f44e6bd4347a201306364e5f6d2013d6ff498"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/modeldba/sql-surveyor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modeldba%2Fsql-surveyor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modeldba%2Fsql-surveyor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modeldba%2Fsql-surveyor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modeldba%2Fsql-surveyor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modeldba","download_url":"https://codeload.github.com/modeldba/sql-surveyor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modeldba%2Fsql-surveyor/sbom","scorecard":{"id":655895,"data":{"date":"2025-08-11","repo":{"name":"github.com/modeldba/sql-surveyor","commit":"8f1f44e6bd4347a201306364e5f6d2013d6ff498"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch 'storedproc'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"22 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T14:37:47.820Z","repository_id":39696176,"created_at":"2025-08-21T14:37:47.820Z","updated_at":"2025-08-21T14:37:47.820Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30283425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mssql","mysql","parser","plpgsql","plsql","sql","tsql"],"created_at":"2024-08-04T18:01:19.538Z","updated_at":"2026-03-09T04:32:45.251Z","avatar_url":"https://github.com/modeldba.png","language":"TypeScript","readme":"# sql-surveyor\r\n\r\nSQL Surveyor is a zero configuration, high-level SQL parser. Existing parsers are low-level, giving you parse trees instead of\r\neasy access to query details. So we built a high-level parser that handles all the parse tree analysis and\r\nprovides you with an easy to consume object representing your query. Identify tables, columns, aliases \r\nand more in your SQL script in one easy to consume object. See the [full API](https://modeldba.com/sql-surveyor/api) for details.\r\n\r\nParse one query or entire SQL scripts at once.\r\nSupports MySQL, T-SQL (SQL Server), PL/pgSQL (PostgreSQL) and PL/SQL (Oracle) dialects.\r\n\r\n## Install\r\n```shell\r\nnpm install sql-surveyor\r\n```\r\n\r\n## [Full documentation can be found here](https://modeldba.com/sql-surveyor/docs/)\r\n\r\n## Get Started\r\n\r\n```typescript\r\nimport { SQLSurveyor, SQLDialect } from 'sql-surveyor';\r\n\r\nconst sql = 'SELECT t1.columnA, t2.columnB FROM table1 t1 JOIN table2 t2 ON t1.id = t2.table1_id';\r\nconst surveyor = new SQLSurveyor(SQLDialect.PLSQL);\r\nconst parsedSql = surveyor.survey(sql);\r\nconsole.dir(parsedSql, { depth: null });\r\n\r\n// ParsedSql {\r\n//  parsedQueries: {\r\n//   '0': ParsedQuery {\r\n//    outputColumns: [\r\n//     OutputColumn { columnName: 'columnA', columnAlias: null, tableName: 'table1', tableAlias: 't1'},\r\n//     OutputColumn { columnName: 'columnB', columnAlias: null, tableName: 'table2', tableAlias: 't2'}\r\n//    ],\r\n//    referencedColumns: [\r\n//      ReferencedColumn { \r\n//       columnName: 'id', tableName: 'table1', tableAlias: 't1', \r\n//       locations: Set { \r\n//        TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 63, stopIndex: 67 } \r\n//       }\r\n//      },\r\n//      ReferencedColumn { \r\n//       columnName: 'table1_id', tableName: 'table2', tableAlias: 't2', \r\n//       locations: Set {\r\n//        TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 71, stopIndex: 82 } \r\n//       }\r\n//      }\r\n//    ],\r\n//    referencedTables: {\r\n//      table1: ReferencedTable { \r\n//        tableName: 'table1', schemaName: null, databaseName: null, aliases: Set { 't1' }, \r\n//        locations: Set { \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 35, stopIndex: 40 }, \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 63, stopIndex: 64 }, \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 7, stopIndex: 8 } }\r\n//        },\r\n//      table2: ReferencedTable { \r\n//        tableName: 'table2', schemaName: null, databaseName: null, aliases: Set { 't2' }, \r\n//        locations: Set { \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 50, stopIndex: 55 }, \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 71, stopIndex: 72 }, \r\n//         TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 19, stopIndex: 20 } \r\n//        }\r\n//      }\r\n//   },\r\n//   tokens: {\r\n//    '0': Token { value: 'SELECT', type: 'KEYWORD', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 0, stopIndex: 5 }},\r\n//    '7': Token { value: 't1', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 7, stopIndex: 8 }},\r\n//    '9': Token { value: '.', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 9, stopIndex: 9 }},\r\n//    '10': Token { value: 'columnA', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 10, stopIndex: 16 }},\r\n//    '17': Token { value: ',', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 17, stopIndex: 17 }},\r\n//    '19': Token { value: 't2', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 19, stopIndex: 20 }},\r\n//    '21': Token { value: '.', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 21, stopIndex: 21 }},\r\n//    '22': Token { value: 'columnB', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 22, stopIndex: 28 }},\r\n//    '30': Token { value: 'FROM', type: 'KEYWORD', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 30, stopIndex: 33 }},\r\n//    '35': Token { value: 'table1', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 35, stopIndex: 40 }},\r\n//    '42': Token { value: 't1', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 42, stopIndex: 43 }},\r\n//    '45': Token { value: 'JOIN', type: 'KEYWORD', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 45, stopIndex: 48 }},\r\n//    '50': Token { value: 'table2', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 50, stopIndex: 55 }},\r\n//    '57': Token { value: 't2', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 57, stopIndex: 58 }},\r\n//    '60': Token { value: 'ON', type: 'KEYWORD', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 60, stopIndex: 61 }},\r\n//    '63': Token { value: 't1', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 63, stopIndex: 64 }},\r\n//    '65': Token { value: '.', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 65, stopIndex: 65 }},\r\n//    '66': Token { value: 'id', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 66, stopIndex: 67 }},\r\n//    '69': Token { value: '=', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 69, stopIndex: 69 }},\r\n//    '71': Token { value: 't2', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 71, stopIndex: 72 }},\r\n//    '73': Token { value: '.', type: 'OPERATOR', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 73, stopIndex: 73 }},\r\n//    '74': Token { value: 'table1_id', type: 'IDENTIFIER', location: TokenLocation { lineStart: 1, lineEnd: 1, startIndex: 74, stopIndex: 82 }}\r\n//    },\r\n//    query: 'SELECT t1.columnA, t2.columnB FROM table1 t1 JOIN table2 t2 ON t1.id = t2.table1_id',\r\n//    queryType: 'DML',\r\n//    queryLocation: TokenLocation { lineStart: 1,lineEnd: 1,startIndex: 0,stopIndex: 82 },\r\n//    queryErrors: [],\r\n//    subqueries: {},\r\n//    commonTableExpressions: {}\r\n//   }\r\n//  }\r\n// }\r\n```\r\n\r\n## Created By\r\n\r\n[![modelDBA logo](https://modeldba.com/sql-surveyor/modelDBA128x128.png \"modelDBA\")](https://modeldba.com)\r\n\r\nsql-surveyor is a project created and maintained by [modelDBA](https://modeldba.com), a database IDE for modern developers. \r\nmodelDBA lets you visualize SQL as you type and edit tables easily with a no-code table editor.\r\n\r\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodeldba%2Fsql-surveyor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodeldba%2Fsql-surveyor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodeldba%2Fsql-surveyor/lists"}