Comments (3)
@georgesittas Thank you!
from sqlglot.
STRICT
keyword (alias for RETURNS NULL ON NULL INPUT
) is also not supported correctly;
>>> create_text = """
... CREATE OR REPLACE FUNCTION ibis_udfs.public.object_values("obj" OBJECT)
... RETURNS ARRAY
... LANGUAGE JAVASCRIPT
... STRICT
... AS
... $$ return Object.values(obj) $$
... """
>>> expr = sqlglot.parse_one(create_text, dialect='snowflake')
>>> expr
Create(
this=UserDefinedFunction(
this=Dot(
this=Dot(
this=Identifier(this=ibis_udfs, quoted=False),
expression=Identifier(this=public, quoted=False)),
expression=Identifier(this=object_values, quoted=False)),
expressions=[
ColumnDef(
this=Identifier(this=obj, quoted=True),
kind=DataType(this=Type.OBJECT, nested=True))],
wrapped=True),
kind=FUNCTION,
replace=True,
expression=Alias(
this=Column(
this=Identifier(this=STRICT, quoted=False)),
alias=Identifier(this=return Object.values(obj) , quoted=False)),
properties=Properties(
expressions=[
ReturnsProperty(
this=DataType(this=Type.ARRAY, nested=True)),
LanguageProperty(
this=Var(this=JAVASCRIPT))]))
>>> print(expr)
CREATE OR REPLACE FUNCTION ibis_udfs.public.object_values("obj" OBJECT) RETURNS ARRAY LANGUAGE JAVASCRIPT AS STRICT AS return Object.values(obj)
CREATE OR REPLACE FUNCTION ibis_udfs.public.object_values("obj" OBJECT) RETURNS ARRAY LANGUAGE JAVASCRIPT AS STRICT AS return Object.values(obj)
raises the error:
Syntax error: unexpected 'STRICT'. (line 1)
from sqlglot.
this isn’t high priority for us, feel free to submit a pr for this.
we welcome well documented, tested, and conforming prs, but won’t have time to implement this one for you
from sqlglot.
Related Issues (20)
- tSQL If condition ParseError HOT 1
- Improve pretty-printing for `CASE WHEN .. THEN ..` expressions HOT 1
- Prefix comments with `--` when pretty-printing whole-line comments HOT 1
- DuckDB base text types incorrect HOT 7
- Support ALTER VIEW in expression HOT 3
- Issue parsing `gen_random_uuid()` in postgres script.
- Support parsing of comma separated alter table clauses (snowflake) HOT 1
- Incorrect type cast in conversion from Spark to Presto in timestampad function HOT 2
- NULLS FIRST added to ORDER BY with oracle dialect. At least it should be NULLS LAST when sort direction is not provided. HOT 1
- Parsing falls back to Command when using BEGIN in BigQuery multi-statement HOT 1
- SAS dialect HOT 1
- duckdb binder error after json_extract_string is converted to ->> HOT 2
- `CREATE INDEX CONCURRENTLY` not parsed by postgres dialect
- dialect: postgres, `CREATE AGGREGATE` and `CREATE EXTENSION` treated as invalid syntax, unsure if expected or bug. HOT 7
- INSERT incorrectly roundtripped in mysql dialect.
- generate_series() is not transpiled to sequence() when going from duckdb to spark sql
- transpile removes some comments HOT 1
- Trino/Presto parsing allowing invalid syntax HOT 1
- Time format for Spark to Presto conversion of unix_timestamp not inclusive of microseconds HOT 7
- Transpile not working for postgres/duckdb HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlglot.