-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added renderer for SqlGenerateUuidExpression
- Loading branch information
1 parent
485fbec
commit b677a2b
Showing
7 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from metricflow.sql.render.expr_renderer import ( | ||
DefaultSqlExpressionRenderer, | ||
SqlExpressionRenderer, | ||
SqlExpressionRenderResult, | ||
) | ||
from metricflow.sql.render.sql_plan_renderer import DefaultSqlQueryPlanRenderer | ||
from metricflow.sql.sql_bind_parameters import SqlBindParameters | ||
from metricflow.sql.sql_exprs import SqlGenerateUuidExpression | ||
|
||
|
||
class SnowflakeSqlExpressionRenderer(DefaultSqlExpressionRenderer): | ||
"""Expression renderer for the Snowflake engine.""" | ||
|
||
def visit_generate_uuid_expr(self, node: SqlGenerateUuidExpression) -> SqlExpressionRenderResult: # noqa: D | ||
return SqlExpressionRenderResult( | ||
sql="UUID_STRING()", | ||
execution_parameters=SqlBindParameters(), | ||
) | ||
|
||
|
||
class SnowflakeSqlQueryPlanRenderer(DefaultSqlQueryPlanRenderer): | ||
"""Plan renderer for the Snowflake engine.""" | ||
|
||
EXPR_RENDERER = SnowflakeSqlExpressionRenderer() | ||
|
||
@property | ||
def expr_renderer(self) -> SqlExpressionRenderer: # noqa :D | ||
return self.EXPR_RENDERER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters