def _ensure_dataset_exists()

in common/big_query/big_query_adapter.py [0:0]


    def _ensure_dataset_exists(self) -> bigquery.Dataset:
        """
        Retrieves the dataset, creating it if it does not exist.
        """
        try:
            dataset_ref = bigquery.DatasetReference(
                self._project, self._dataset_name
            )
            return self._client.get_dataset(dataset_ref)
        except NotFound:
            dataset = bigquery.Dataset(dataset_ref)
            dataset.location = self._dataset_location
            return self._client.create_dataset(dataset)