1
0
Fork 0

Adding upstream version 22.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:29:15 +01:00
parent b01402dc30
commit f1aa09959c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
148 changed files with 68457 additions and 63176 deletions

View file

@ -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
}]
```