optimus
optimus copied to clipboard
refactor: bigquery datastore
The current implementation of bigquery datastore (here) has methods with similar implementations, mainly on CreateResource
and UpdateResource
. These methods are similar, with only difference is how the parameters being sent to the underlying functions, specifically the upsert
flag.
The flag is not exposed to the outside world, which is a good thing. But, the underlying functions that are being called are not really clear with this flag. Take an example function createTable
with the flag true
means create a non-existing table or update the existing one, and false
means create a non-existing table or ignore update. Rather than doing so, it's better to have it separated. For example, createTable
only creates from a non-existing one, updateTable
only update an existing one, and upsertTable
is basically to call the previous two.