class_docstr: Expression renderer for the BigQuery engine.
class_docstr_tok: ["Expression","renderer","for","the","BigQuery","engine","."]
docstr: Render DATE_TRUNC for BigQuery, which takes the opposite argument order from Snowflake and Redshift.
docstr_tok: ["Render","DATE_TRUNC","for","BigQuery",",","which","takes","the","opposite","argument","order","from","Snowflake","and","Redshift","."]
code: def visit_date_trunc_expr(
      self, node: SqlDateTruncExpression
  ) -> SqlExpressionRenderResult:
      """Render DATE_TRUNC for BigQuery, which takes the opposite argument order from Snowflake and Redshift."""
      arg_rendered = self.render_sql_expr(node.arg)
  
      prefix = ""
      if node.time_granularity == TimeGranularity.WEEK:
          prefix = "iso"
  
      return SqlExpressionRenderResult(
          sql=f"DATE_TRUNC({arg_rendered.sql}, {prefix}{node.time_granularity.value})",
          bind_parameters=arg_rendered.bind_parameters,
      )
  
imports: from __future__ import annotations
  from fractions import Fraction
  from typing import Collection
  from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from typing_extensions import override
  from metricflow.errors.errors import UnsupportedEngineFeatureError
  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 SqlCastToTimestampExpression, SqlDateTruncExpression, SqlExtractExpression, SqlGenerateUuidExpression, SqlPercentileExpression, SqlPercentileFunctionType, SqlSubtractTimeIntervalExpression
  from metricflow.sql.sql_plan import SqlSelectColumn
label_desc: Use image node_id 7 for calling the BigQuerySqlExpressionRenderer obj's underlying member method code with example usage: obj.visit_date_trunc_expr(node) and returns: SqlExpressionRenderResult