Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Repairing numBytes issue. numBytes is now showing exact numBytes from… #22

Merged
merged 3 commits into from
Aug 13, 2018

Conversation

radkomateusz
Copy link
Contributor

… backup table in Big Query (not source table).

Now, bbq is querying for backup table metadata (instead of source table). Thanks to that, numBytes shows exact number of Bytes for backupTable - it makes our Datastore entries more consistent (earlier numBytes could change between copyJob start and creating Backup entity).

Note: as targetTableId doesn't contains partition, above imoplementation seems to be invalid, but we always backup partition into their own table -> so size of whole table equals to size of single partition in case of backups.

Some refactorings (using data from copyJob configuration).

Update unit tests to be consistent (the same data in 'given part' and in used CopyJobResult example)

… backup table in Big Query (not source table).

Now, bbq is querying for backup table metadata (instead of source table). Thanks to that, numBytes shows exact number of Bytes for backupTable - it makes our Datastore entries more consistent (earlier numBytes could change between copyJob start and creating Backup entity).

Note: as targetTableId doesn't contains partition, above imoplementation seems to be invalid, but we always backup partition into their own table -> so size of whole table equals to size of single partition in case of backups.

Some refactorings (using data from copyJob configuration).

Update unit tests to be consistent (the same data in 'given part' and in used CopyJobResult example)
@coveralls
Copy link

coveralls commented Jul 30, 2018

Pull Request Test Coverage Report for Build 387

  • 16 of 16 (100.0%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 82.298%

Files with Coverage Reduction New Missed Lines %
src/backup/after_backup_action_handler.py 4 89.55%
Totals Coverage Status
Change from base Build 385: -0.03%
Covered Lines: 2027
Relevant Lines: 2463

💛 - Coveralls

else:
logging.info(
"Source table {0} not exist. Backup entity is not created".format(
source_table_reference))
"Backup table {0} not exist. Backup entity is not created".format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If backup doesn't exist we should raise error via Error Reporting

@@ -35,6 +36,16 @@ def source_bq_table(self):
return BigQueryTable(self.source_project_id, self.source_dataset_id,
self.source_table_id)

@property
def source_table_reference(self):
table_id, partition_id = BigQueryTable \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this implementation to BigQueryTable class. Then you could have:
return self.source_bq_table.get_table_reference()

… but copy job was return as success.

Moving creation of table_reference based on bq_table to Table reference class (moving it to BQTable causes cyclic reference errors). Repairs unit tests to not require internet connection. Some method was renamed to achieve consistency with updates.
@radkomateusz radkomateusz merged commit 4ac6f5b into master Aug 13, 2018
@radkomateusz radkomateusz deleted the numBytesRepair branch August 13, 2018 11:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants