Git Product home page Git Product logo

Comments (3)

krzysztof-kwitt avatar krzysztof-kwitt commented on July 23, 2024 1

@georgesittas Thank you!
image

from sqlglot.

krzysztof-kwitt avatar krzysztof-kwitt commented on July 23, 2024

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.

tobymao avatar tobymao commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.