-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bigquery handles airbyte_meta/sync_id/generation_id
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ntegrations/destination/bigquery/migrators/BigqueryAirbyteMetaAndGenerationIdMigration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.airbyte.integrations.destination.bigquery.migrators | ||
|
||
import io.airbyte.integrations.base.destination.typing_deduping.DestinationHandler | ||
import io.airbyte.integrations.base.destination.typing_deduping.DestinationInitialStatus | ||
import io.airbyte.integrations.base.destination.typing_deduping.StreamConfig | ||
import io.airbyte.integrations.base.destination.typing_deduping.migrators.Migration | ||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
|
||
class BigqueryAirbyteMetaAndGenerationIdMigration: Migration<BigQueryDestinationState> { | ||
private val logger = KotlinLogging.logger {} | ||
|
||
override fun migrateIfNecessary( | ||
destinationHandler: DestinationHandler<BigQueryDestinationState>, | ||
stream: StreamConfig, | ||
state: DestinationInitialStatus<BigQueryDestinationState> | ||
): Migration.MigrationResult<BigQueryDestinationState> { | ||
if (!state.initialRawTableStatus.rawTableExists) { | ||
// The raw table doesn't exist. No migration necessary. Update the state. | ||
logger.info { | ||
"Skipping generation_id migration for ${stream.id.originalNamespace}.${stream.id.originalName} because the raw table doesn't exist" | ||
} | ||
return Migration.MigrationResult(state.destinationState, false) | ||
} | ||
|
||
TODO("Not yet implemented") | ||
} | ||
} |