From 4b3828f9faa5d7d77ad6d5b7ca4a5f4904ad7732 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 16 Jan 2024 12:43:33 -0600 Subject: [PATCH] [DC-3643] Remove depreciated function --- data_steward/bq_utils.py | 42 ---------------------------------------- 1 file changed, 42 deletions(-) diff --git a/data_steward/bq_utils.py b/data_steward/bq_utils.py index fe502eba2..e0317294a 100644 --- a/data_steward/bq_utils.py +++ b/data_steward/bq_utils.py @@ -1010,45 +1010,3 @@ def has_primary_key(table): id_field = table + '_id' return any(field for field in fields if field['type'] == 'integer' and field['name'] == id_field) - - -@deprecated(reason='create_snapshot_dataset is deprecated') -def create_snapshot_dataset(project_id, dataset_id, snapshot_dataset_id): - """ - - :param dataset_id: - :param project_id: - :param snapshot_dataset_id: - :return: - """ - dataset_result = create_dataset(project_id=project_id, - dataset_id=snapshot_dataset_id, - description=f'Snapshot of {dataset_id}', - overwrite_existing=True) - validation_dataset = dataset_result.get(bq_consts.DATASET_REF, {}) - snapshot_dataset_id = validation_dataset.get(bq_consts.DATASET_ID, '') - # Create the empty tables in the new snapshot dataset - for table_id in list_all_table_ids(dataset_id): - metadata = get_table_info(table_id, dataset_id) - fields = metadata['schema']['fields'] - create_table(table_id, - fields, - drop_existing=True, - dataset_id=snapshot_dataset_id) - # Copy the table content from the current dataset to the snapshot dataset - copy_table_job_ids = [] - for table_id in list_all_table_ids(dataset_id): - select_all_query = ( - 'SELECT * FROM `{project_id}.{dataset_id}.{table_id}` ') - q = select_all_query.format(project_id=project_id, - dataset_id=dataset_id, - table_id=table_id) - results = query(q, - use_legacy_sql=False, - destination_table_id=table_id, - destination_dataset_id=snapshot_dataset_id, - batch=True) - copy_table_job_ids.append(results['jobReference']['jobId']) - incomplete_jobs = wait_on_jobs(copy_table_job_ids) - if len(incomplete_jobs) > 0: - raise BigQueryJobWaitError(incomplete_jobs)