def table_exists ( self , table ) : if not self . dataset_exists ( table . dataset ) : return False try : self . client . tables ( ) . get ( projectId = table . project_id , datasetId = table . dataset_id , tableId = table . table_id ) . execute ( ) except http . HttpError as ex : if ex . resp . status == 404 : return False raise return True
python check if table exists
Returns whether the given table exists .
def table_exists(self, table):
        """Returns whether the given table exists.

           :param table:
           :type table: BQTable
        """
        if not self.dataset_exists(table.dataset):
            return False

        try:
            self.client.tables().get(projectId=table.project_id,
                                     datasetId=table.dataset_id,
                                     tableId=table.table_id).execute()
        except http.HttpError as ex:
            if ex.resp.status == 404:
                return False
            raise

        return True