Class BigQuerySqlUtils


  • public class BigQuerySqlUtils
    extends Object
    Utilities that help with Sql operations using StringTemplate.
    • Method Detail

      • buildSql

        public static String buildSql​(TableName tableName,
                                      org.apache.arrow.vector.types.pojo.Schema schema,
                                      Constraints constraints,
                                      List<com.google.cloud.bigquery.QueryParameterValue> parameterValues)
        Builds an SQL statement from the schema, table name, split and constraints that can be executable by BigQuery using StringTemplate approach.
        Parameters:
        tableName - The table name of the table we are querying.
        schema - The schema of the table that we are querying.
        constraints - The constraints that we want to apply to the query.
        parameterValues - Query parameter values for parameterized query.
        Returns:
        SQL Statement that represents the table, columns, split, and constraints.
      • renderTemplate

        public static String renderTemplate​(String templateName,
                                            Map<String,​Object> params)
        Generic method to render any string template with parameters
        Parameters:
        templateName - The name of the template to render
        params - Map of parameter key-value pairs
        Returns:
        The rendered template string