From 42a1548cecf48d18233f56e3385cf9c89abcb9c2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 3 Mar 2024 15:11:07 +0100 Subject: Merging upstream version 22.2.0. Signed-off-by: Daniel Baumann --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 52df5b6..da58b12 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ sqlglot.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive") ``` ```sql -'SELECT FROM_UNIXTIME(1618088028295 / 1000)' +'SELECT FROM_UNIXTIME(1618088028295 / POW(10, 3))' ``` SQLGlot can even translate custom time formats: @@ -202,13 +202,13 @@ When the parser detects an error in the syntax, it raises a ParseError: ```python import sqlglot -sqlglot.transpile("SELECT foo( FROM bar") +sqlglot.transpile("SELECT foo FROM (SELECT baz FROM t") ``` ``` -sqlglot.errors.ParseError: Expecting ). Line 1, Col: 13. - select foo( FROM bar - ~~~~ +sqlglot.errors.ParseError: Expecting ). Line 1, Col: 34. + SELECT foo FROM (SELECT baz FROM t + ~ ``` Structured syntax errors are accessible for programmatic use: @@ -216,7 +216,7 @@ Structured syntax errors are accessible for programmatic use: ```python import sqlglot try: - sqlglot.transpile("SELECT foo( FROM bar") + sqlglot.transpile("SELECT foo FROM (SELECT baz FROM t") except sqlglot.errors.ParseError as e: print(e.errors) ``` @@ -225,11 +225,11 @@ except sqlglot.errors.ParseError as e: [{ 'description': 'Expecting )', 'line': 1, - 'col': 16, - 'start_context': 'SELECT foo( ', - 'highlight': 'FROM', - 'end_context': ' bar', - 'into_expression': None, + 'col': 34, + 'start_context': 'SELECT foo FROM (SELECT baz FROM ', + 'highlight': 't', + 'end_context': '', + 'into_expression': None }] ``` -- cgit v1.2.3