Git Product home page Git Product logo

Comments (7)

tobymao avatar tobymao commented on May 13, 2024

this is not too difficult, just need to support single semicolon, if you want to take a stab at this, i can walk you through what needs to be done. can do a vid call or some kind of chat app to sync if you're interested.

i'm not familiar with snowflake, but is x:y just JSON_PATH(x, y) or STRUCT_EXTRACT?, seems more similar to struct_extract...

from sqlglot.

tobymao avatar tobymao commented on May 13, 2024

@danfrankj i'm reading through snowflake docs and i don't quite understand the difference between : and .

can i just convert : -> .? this is a one line change

diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 117b0c9..7edb4a8 100644
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -1103,7 +1103,7 @@ class Parser:
             this = self.expression(exp.Column, this=this)
         this = self._parse_bracket(this)
 
-        while self._match(TokenType.DOT):
+        while self._match_set({TokenType.DOT, TokenType.COLON}):
             field = self._parse_id_var() or self._parse_star()
             if isinstance(this, exp.Column) and not this.table:
                 this = self.expression(exp.Column, this=field, table=this.this)

from sqlglot.

NodeJSmith avatar NodeJSmith commented on May 13, 2024

@tobymao I know this is closed, but I'm hitting the same issue currently with version 10.5.10. Happy to provide more information and/or to open a new issue for this. Below is a screenshot of the issue - I imagine it's because there are double quotes, since that is what seems to differ between my example and the example provided by @danfrankj

image

from sqlglot.

tobymao avatar tobymao commented on May 13, 2024

please open a new issue thanks!

from sqlglot.

tobymao avatar tobymao commented on May 13, 2024

@NodeJSmith i tried to recreate your error from your screen shot but it seems to work

python -m sqlglot 'select generated_features:"uws.rcu"' --read=snowflake
SELECT
  "generated_features"['uws.rcu']

from sqlglot.

tobymao avatar tobymao commented on May 13, 2024

don't forget to pass the read dialect in as snowflake

from sqlglot.

NodeJSmith avatar NodeJSmith commented on May 13, 2024

@tobymao fudge, I totally forgot to do that 🤦‍♀️ I'll try it today, I imagine that will fix it. Sorry for the false alarm

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.