Example #1
0
 def poke(self, context):
     table_uri = '{0}:{1}.{2}'.format(self.project_id, self.dataset_id,
                                      self.table_id)
     self.log.info(
         'Sensor checks existence of partition: "%s" in table: %s',
         self.partition_id, table_uri)
     hook = BigQueryHook(bigquery_conn_id=self.bigquery_conn_id,
                         delegate_to=self.delegate_to)
     return hook.table_partition_exists(project_id=self.project_id,
                                        dataset_id=self.dataset_id,
                                        table_id=self.table_id,
                                        partition_id=self.partition_id)
Example #2
0
 def poke(self, context: 'Context') -> bool:
     table_uri = f'{self.project_id}:{self.dataset_id}.{self.table_id}'
     self.log.info('Sensor checks existence of partition: "%s" in table: %s', self.partition_id, table_uri)
     hook = BigQueryHook(
         gcp_conn_id=self.gcp_conn_id,
         delegate_to=self.delegate_to,
         impersonation_chain=self.impersonation_chain,
     )
     return hook.table_partition_exists(
         project_id=self.project_id,
         dataset_id=self.dataset_id,
         table_id=self.table_id,
         partition_id=self.partition_id,
     )