def create_tables()

in nl2sql/datasets/custom.py [0:0]


    def create_tables(self):
        """
        Create Tables in Bigquery based on the sheetname in excel file.
        """
        workbook = openpyxl.load_workbook(self.filepath)
        sheetnames = workbook.sheetnames
        sheetnames = [
            sheetname
            for sheetname in sheetnames
            if sheetname not in ["Primary Keys", "Foreign Keys"]
        ]
        for sheetname in sheetnames:
            table_id = f"{self.dataset_name}.{sheetname}"
            table_df = pd.read_excel(self.filepath, sheet_name=sheetname)
            table_df = table_df.convert_dtypes()
            schema = self.generate_bigquery_schema(table_df)
            job_config = bigquery.LoadJobConfig(
                schema=schema, write_disposition="WRITE_TRUNCATE"
            )
            job = self.client.load_table_from_dataframe(
                table_df, table_id, job_config=job_config
            )
            job.result()
            logger.success(f"Created table {table_id}")