SQLGLOT Parser Expert
Budget: ₹1,000 – ₹2,000 INR
I am seeking a skilled Python programmer for a SQL parsing project. You must know how to traverse an AST!
Key Tasks:
There is a query it could be in SQL or in partial expression format.I need you too parse that query using sqlglot parser and extract functions and field names .
You need to create 2 functions one for extracting fields one for extracting functions use only sqlglot library to parse.
*expression could be a sql query or a partial expression
Write your functions here:--------
import sqlglot
def extract_field_names(expression):
field_names = set()
//write logic to extract field names using sqlglot
return field_names
def extract_function_names(expression):
function_names =set()
//write logic to extract function names using sqlglot
return function_names
expression = "if(status == 'converted', if(github_status == 'not_uploaded', True, False), if(status == 'converted', if(version <= 2, True, False), False))"
expr = sqlglot.parse_one(expression)
field_names = extract_field_names(expr)
print(field_names)
functions_names =extract_function_names(expr)
print(function_names)
For this expression output would be
field_names = {'version', 'github_status', 'status'}
functions_names = {'if'}
Key Tasks:
There is a query it could be in SQL or in partial expression format.I need you too parse that query using sqlglot parser and extract functions and field names .
You need to create 2 functions one for extracting fields one for extracting functions use only sqlglot library to parse.
*expression could be a sql query or a partial expression
Write your functions here:--------
import sqlglot
def extract_field_names(expression):
field_names = set()
//write logic to extract field names using sqlglot
return field_names
def extract_function_names(expression):
function_names =set()
//write logic to extract function names using sqlglot
return function_names
expression = "if(status == 'converted', if(github_status == 'not_uploaded', True, False), if(status == 'converted', if(version <= 2, True, False), False))"
expr = sqlglot.parse_one(expression)
field_names = extract_field_names(expr)
print(field_names)
functions_names =extract_function_names(expr)
print(function_names)
For this expression output would be
field_names = {'version', 'github_status', 'status'}
functions_names = {'if'}