def to_bigquery_ddl(self, name_case=DdlParseBase.NAME_CASE.original):
        """
        Generate BigQuery CREATE TABLE statements

        :param name_case: name case type
            * DdlParse.NAME_CASE.original : Return to no convert
            * DdlParse.NAME_CASE.lower : Return to lower
            * DdlParse.NAME_CASE.upper : Return to upper

        :return: BigQuery CREATE TABLE statements
        """

        if self.schema is None:
            dataset = "dataset"
        elif name_case == self.NAME_CASE.lower:
            dataset = self.schema.lower()
        elif name_case == self.NAME_CASE.upper:
            dataset = self.schema.upper()
        else:
            dataset = self.schema

        cols_defs = []
        for col in self.columns.values():
            col_name = col.get_name(name_case)

            if col.array_dimensional < 1:
                # no array data type
                type = col.bigquery_standard_data_type
                not_null = " NOT NULL" if col.not_null else ""

            else:
                # one or multiple dimensional array data type
                type_front = "ARRAY<"
                type_back = ">"
                for i in range(1, col.array_dimensional):
                    type_front += "STRUCT<dimension_{} ARRAY<".format(i)
                    type_back += ">>"

                type = "{}{}{}".format(type_front, col.bigquery_standard_data_type, type_back)
                not_null = ""

            cols_defs.append("{name} {type}{not_null}".format(
                name=col_name,
                type=type,
                not_null=not_null,
            ))

        return textwrap.dedent(
            """\
            #standardSQL
            CREATE TABLE `project.{dataset}.{table}`
            (
              {colmns_define}
            )""").format(
            dataset=dataset,
            table=self.get_name(name_case),
            colmns_define=",\n  ".join(cols_defs),
        )
def to_bigquery_ddl ( self , name_case = DdlParseBase . NAME_CASE . original ) : if self . schema is None : dataset = "dataset" elif name_case == self . NAME_CASE . lower : dataset = self . schema . lower ( ) elif name_case == self . NAME_CASE . upper : dataset = self . schema . upper ( ) else : dataset = self . schema cols_defs = [ ] for col in self . columns . values ( ) : col_name = col . get_name ( name_case ) if col . array_dimensional < 1 : type = col . bigquery_standard_data_type not_null = " NOT NULL" if col . not_null else "" else : type_front = "ARRAY<" type_back = ">" for i in range ( 1 , col . array_dimensional ) : type_front += "STRUCT<dimension_{} ARRAY<" . format ( i ) type_back += ">>" type = "{}{}{}" . format ( type_front , col . bigquery_standard_data_type , type_back ) not_null = "" cols_defs . append ( "{name} {type}{not_null}" . format ( name = col_name , type = type , not_null = not_null , ) ) return textwrap . dedent ( """\
            #standardSQL
            CREATE TABLE `project.{dataset}.{table}`
            (
              {colmns_define}
            )""" ) . format ( dataset = dataset , table = self . get_name ( name_case ) , colmns_define = ",\n  " . join ( cols_defs ) , )
Generate BigQuery CREATE TABLE statements

        :param name_case: name case type
            * DdlParse.NAME_CASE.original : Return to no convert
            * DdlParse.NAME_CASE.lower : Return to lower
            * DdlParse.NAME_CASE.upper : Return to upper

        :return: BigQuery CREATE TABLE statements