dpgaspar commented on PR #25014:
URL: https://github.com/apache/superset/pull/25014#issuecomment-1682674082
> Looks good, but I'm worried about all the possible edge case we're missing.
>
> I wonder if we should **also** use sqloxide to prevent false negatives.
We'd try to parse with sqloxide, check for non-selects, return false if we do.
If we don't, we then run the current flow with sqlparse.
>
> ```python
> >>> parse_sql("WITH a AS ( INSERT INTO foo (id) VALUES (1) RETURNING id )
SELECT * FROM a;", "ansi")
> [{'Query': {'with': {'recursive': False, 'cte_tables': [{'alias': {'name':
{'value': 'a', 'quote_style': None}, 'columns': []}, 'query': {'with': None,
'body': {'Insert': {'Insert': {'or': None, 'into': True, 'table_name':
[{'value': 'foo', 'quote_style': None}], 'columns': [{'value': 'id',
'quote_style': None}], 'overwrite': False, 'source': {'with': None, 'body':
{'Values': {'explicit_row': False, 'rows': [[{'Value': {'Number': ('1',
False)}}]]}}, 'order_by': [], 'limit': None, 'offset': None, 'fetch': None,
'locks': []}, 'partitioned': None, 'after_columns': [], 'table': False, 'on':
None, 'returning': [{'UnnamedExpr': {'Identifier': {'value': 'id',
'quote_style': None}}}]}}}, 'order_by': [], 'limit': None, 'offset': None,
'fetch': None, 'locks': []}, 'from': None}]}, 'body': {'Select': {'distinct':
False, 'top': None, 'projection': [{'Wildcard': {'opt_exclude': None,
'opt_except': None, 'opt_rename': None, 'opt_replace': None}}], 'into': None,
'from': [{'relation': {'Table':
{'name': [{'value': 'a', 'quote_style': None}], 'alias': None, 'args': None,
'with_hints': []}}, 'joins': []}], 'lateral_views': [], 'selection': None,
'group_by': [], 'cluster_by': [], 'distribute_by': [], 'sort_by': [], 'having':
None, 'qualify': None}}, 'order_by': [], 'limit': None, 'offset': None,
'fetch': None, 'locks': []}}]
> ```
nice!, will try that!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]