-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge latest changes from main branch
- Loading branch information
Showing
2,023 changed files
with
247,862 additions
and
81,862 deletions.
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
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
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
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
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
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
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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
airbyte-cdk/bulk/core/base/src/main/resources/application.yaml
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,4 @@ | ||
airbyte: | ||
file-transfer: | ||
enabled: ${USE_FILE_TRANSFER:false} | ||
staging-path: ${AIRBYTE_STAGING_DIRECTORY:/staging/files} |
40 changes: 40 additions & 0 deletions
40
...e-cdk/bulk/core/base/src/test/kotlin/io/airbyte/cdk/initialization/TestApplicationYaml.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,40 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.initialization | ||
|
||
import io.micronaut.context.annotation.Bean | ||
import io.micronaut.context.annotation.Factory | ||
import io.micronaut.context.annotation.Value | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import kotlin.test.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
@MicronautTest | ||
class TestApplicationYaml { | ||
@Inject lateinit var defaultValueBean: DefaultValueBean | ||
|
||
@Test | ||
fun testMainDefaultValue() { | ||
assertEquals("/staging/files", defaultValueBean.stagingFolder) | ||
assertEquals(false, defaultValueBean.fileTransferEnable) | ||
} | ||
} | ||
|
||
data class DefaultValueBean( | ||
val stagingFolder: String, | ||
val fileTransferEnable: Boolean, | ||
) | ||
|
||
@Factory | ||
class TestFactory { | ||
@Bean | ||
fun defaultValueBean( | ||
@Value("\${airbyte.file-transfer.staging-path}") stagingFolder: String, | ||
@Value("\${airbyte.file-transfer.enabled}") fileTransferEnable: Boolean, | ||
): DefaultValueBean { | ||
return DefaultValueBean(stagingFolder, fileTransferEnable) | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
airbyte-cdk/bulk/core/extract/src/main/kotlin/io/airbyte/cdk/discover/MetaFieldDecorator.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,58 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.discover | ||
|
||
import com.fasterxml.jackson.databind.node.ObjectNode | ||
import io.airbyte.cdk.command.OpaqueStateValue | ||
import io.airbyte.cdk.read.Stream | ||
import io.airbyte.protocol.models.v0.AirbyteStream | ||
import java.time.OffsetDateTime | ||
|
||
/** [MetaField] schema definition and utilities, to be implemented by each source connector. */ | ||
interface MetaFieldDecorator { | ||
|
||
/** [MetaField] to use as a global cursor, if applicable. */ | ||
val globalCursor: MetaField? | ||
|
||
/** | ||
* All [MetaField]s to be found in [Global] stream records. | ||
* | ||
* This must include at least [globalCursor] if not null. | ||
* | ||
* Empty set when not applicable. | ||
*/ | ||
val globalMetaFields: Set<MetaField> | ||
|
||
/** Convenience function for [AirbyteStreamFactory]. */ | ||
fun decorateAirbyteStream(airbyteStream: AirbyteStream) { | ||
(airbyteStream.jsonSchema["properties"] as ObjectNode).apply { | ||
for (metaField in globalMetaFields) { | ||
set<ObjectNode>(metaField.id, metaField.type.airbyteSchemaType.asJsonSchema()) | ||
} | ||
} | ||
val globalCursorIdentifier: String = globalCursor?.id ?: return | ||
airbyteStream.defaultCursorField = listOf(globalCursorIdentifier) | ||
airbyteStream.sourceDefinedCursor = true | ||
} | ||
|
||
/** | ||
* Modifies [recordData] by setting all [MetaField] values in global [Stream] feeds. | ||
* | ||
* This is required by the fact that records of a given stream may be emitted by both a [Stream] | ||
* and a [Global] feed and the schemas must be the same. This implies that the records emitted | ||
* by [Stream] must have [MetaField]s set to suitable values, even though that [Feed] has no | ||
* awareness of the [Global] state. | ||
* | ||
* This method is called at most once per [Stream]. | ||
*/ | ||
fun decorateRecordData( | ||
/** Same value as emitted_at */ | ||
timestamp: OffsetDateTime, | ||
/** Current state of the [Global] feed, if applicable. */ | ||
globalStateValue: OpaqueStateValue?, | ||
stream: Stream, | ||
recordData: ObjectNode | ||
) | ||
} |
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
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
Oops, something went wrong.