We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for this useful library!
This issue is similar to #21 .
When I parse the following SQL (a.sql) :
SELECT EXTRACT(DAYOFWEEK FROM CURRENT_TIMESTAMP() AT TIME ZONE 'Asia/Tokyo') AS as_timestamp
I caught the error:
> parse-sql@1.0.0 sql_parser_cst > ts-node sql_parser_cst.ts /Users/user.name/parse-sql/node_modules/sql-parser-cst/lib/main.js:40 throw new FormattedSyntaxError_2.FormattedSyntaxError(e, sql, options.filename); ^ FormattedSyntaxError: Syntax Error: Unexpected "AT" Was expecting to see: "!=", "%", "&", "(", ")", "*", "+", "-", "->", "->>", ".", "/", "<", "<<", "<=", "<=>", "<>", "=", "==", ">", ">=", ">>", "AND", "BETWEEN", "DIV", "FILTER", "GLOB", "IN", "IS", "ISNULL", "LIKE", "MATCH", "MOD", "NOT", "NOTNULL", "OR", "OVER", "REGEXP", "RLIKE", "[", "^", "|", "||", or whitespace --> undefined:1:51 | 1 | SELECT EXTRACT(DAYOFWEEK FROM CURRENT_TIMESTAMP() AT TIME ZONE 'Asia/Tokyo') AS as_timestamp | ^ at parse (/Users/user.name/parse-sql/node_modules/sql-parser-cst/lib/main.js:40:19) at Object.<anonymous> (/Users/user.name/parse-sql/sql_parser_cst.ts:12:18) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module.m._compile (/Users/user.name/parse-sql/node_modules/ts-node/src/index.ts:1618:23) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Object.require.extensions.<computed> [as .ts] (/Users/user.name/parse-sql/node_modules/ts-node/src/index.ts:1621:12) at Module.load (node:internal/modules/cjs/loader:1119:32) at Function.Module._load (node:internal/modules/cjs/loader:960:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at phase4 (/Users/user.name/parse-sql/node_modules/ts-node/src/bin.ts:649:14)
↓ sql_parser_cst.ts
import fs from 'fs' import path from 'path' import { parse } from 'sql-parser-cst' const sql_path = path.join('a.sql') const sql = fs.readFileSync(sql_path, 'utf8') const cst = parse(sql, { dialect: "bigquery", // These are optional: includeSpaces: true, // Adds spaces/tabs includeNewlines: true, // Adds newlines includeComments: true, // Adds comments includeRange: true, // Adds source code location data }) console.log(cst)
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Will look into it when I get a chance. Been a bit busy lately.
Sorry, something went wrong.
No branches or pull requests
Thank you for this useful library!
This issue is similar to #21 .
When I parse the following SQL (a.sql) :
I caught the error:
↓ sql_parser_cst.ts
The text was updated successfully, but these errors were encountered: