Questions tagged [sqlglot]

6 questions
0
votes
0 answers

Sqlglot Snowflake parsing issue

Input Sql WITH first_activity AS ( SELECT USER_ID, MIN(TO_TIMESTAMP(EVENT_DATE)) AS first_activity_date FROM DF.USER_EVENTS GROUP BY USER_ID ) SELECT COUNT(*) AS active_users_count FROM first_activity WHERE DATEDIFF(day, first_activity_date,…
0
votes
0 answers

Column comparison manipulation with SQLGlot

I am involved in a project that is moving databases from Sybase SQL Anywhere to postgres, the main issue with this is that Sybase SQL Anywhere is natively case insensitive and postgres is not. The patch for this (at the moment) is to use case…
Ridiculon
  • 323
  • 4
  • 12
0
votes
0 answers

How to validate SQL query with unbalanced quotes

We want to parse the mysql query in python project and detect wrong query based on unbalanced quotes or wrong quotes placement or column filtered values having wrong quotes Example: "select * from city where name='x and type=y;" -> Wrong…
Vaibhav
  • 1,154
  • 10
  • 26
0
votes
1 answer

Convert a sql query using sqlglot replace method

I want to achieve the following sql query conversion using sqlglot select * from table where date > abc.def(2 * days) to select * from table where date > {@abc.def(2 * days).xyz(yyyy)} For the first conversion i.e abc to {@abc}, I used the following…
Aman Sharma
  • 73
  • 10
0
votes
1 answer

SQLGlot is throwing an errow when trying to parse a parameter in a SQL statement, i.e "{{parameter}}"

Example query: SELECT * FROM table WHERE parameter is {{parameter}} It's throwing a sqlglot.errors.ParseError. Is there an option to enable this type of option/parameter interpolation, as found in Databricks SQL queries for example? I want to be…
0
votes
1 answer

Node-level documentation for sqlglot

Using the Python library sqlglot, where can I find documentation that explains: Which attributes I should expect to find on which expression nodes types (which arg types does Join, Table, Select, etc. have?) What overall structure I should expect…
GreenGiant
  • 4,930
  • 1
  • 46
  • 76