feat: Add SQLMesh warning when an exp.Command is parsed#3138
Conversation
sqlmesh/core/dialect.py
Outdated
|
|
||
|
|
||
| def _warn_unsupported(self: Parser) -> None: | ||
| self.__warn_unsupported() # type: ignore |
There was a problem hiding this comment.
i don't think we need to call super
There was a problem hiding this comment.
I kept it there to maintain the diagnostic message of which syntax is not supported; The following sqlmesh warning will not suffice for that matter. Wdyt, is it not needed anymore?
There was a problem hiding this comment.
you can make the current message more robust
There was a problem hiding this comment.
Not sure how to word this best for the average user who will probably not understand SQLGlot's exp.Command, SQLMesh's physical table references etc. Happy to change the message to whatever you prefer.
sqlmesh/core/dialect.py
Outdated
| sql = self._find_sql(self._tokens[0], self._tokens[-1])[: self.error_message_context] | ||
|
|
||
| logger.warning( | ||
| f"'{sql}' could not be semantically understood as it contains unsupported syntax, falling back to parsing as 'Command'. SQLMesh is unable to resolve any references to the model's " |
There was a problem hiding this comment.
instead of saying falling back to parsing as a command, maybe say SQLMesh is treating the command as is.
Public slack context
This PR overrides SQLGlot's
_warn_unsupported()to suggest the usage of Jinja on the occasion that the (unsupported) statement is attempting to reference the physical table.