-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load CDK: Expanded namespace coverage #52074
Load CDK: Expanded namespace coverage #52074
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frifriSF59 is adding glue support for null namespace in #52068, so this is actually great timing
changes make sense, I think we probably need more functionality in the test to make this usable for most of our destinations though
@@ -460,12 +460,14 @@ abstract class BasicFunctionalityIntegrationTest( | |||
) | |||
val stream1 = makeStream(randomizedNamespace + "_1") | |||
val stream2 = makeStream(randomizedNamespace + "_2") | |||
val streamWithNullNamespace = makeStream(null, randomizedNamespace + "_stream") | |||
runSync( | |||
configContents, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be some sort of setDefaultNamespace(config, randomizedNamespace + "_default_namespace")
-ish thing
(s3 supports null namespaces out of the box, but db/dw destinations have a config option to set the default schema/database/whatever)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, the default namespace is set by the destination when the provided namespace is null?
If so, it should be null here, but we'll need a DefaultNamespaceProvider to do the test data diffing?
Something like
dumpAndDiffRecords(..., streamWithNullNamespace.copy(descriptor = streamWithNullNamespace.descriptor.copy(namespace = defaultNamespaceProvider.get(randomizedNamespace)), ...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep it's done by the destination connector. e.g. in destination-postgres, the stream namespace turns into a postgres schema. So there's a "default schema" config option, for when a stream has null namespace
Not sure I see the need for a DefaultNamespaceProvider though - i.e. couldn't we hardcode it in the test? (setDefaultNamespace
maybe being an overridable function, or an injected object, or something)
val stream = DestinationStream(Descriptor(namespace = null, name = "test_stream"), ...)
runSync(
config = setDefaultNamespace(config, randomizedNamespace + "_default_namespace"),
stream = stream,
...
)
dumpAndDiff(
stream.copy(
descriptor = stream.descriptor.copy(namespace = randomizedNamespace + "_default_namespace")
), ...
)
(also setDefaultNamespace
maybe can happen during the test class's init
block, to avoid people forgetting to do it)
60d2d64
to
41a3ca8
Compare
b7cf463
to
b1e58e8
Compare
b1e58e8
to
403abba
Compare
403abba
to
a694da5
Compare
a694da5
to
7792525
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test needs to not change the stream name? otherwise lgtm
(also had a question, looking for your thoughts on how to
@@ -466,12 +469,14 @@ abstract class BasicFunctionalityIntegrationTest( | |||
) | |||
val stream1 = makeStream(randomizedNamespace + "_1") | |||
val stream2 = makeStream(randomizedNamespace + "_2") | |||
val streamWithDefaultNamespace = makeStream(null, randomizedNamespace + "_stream") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to change the stream name? I thought the intent of this test was to test that the destination can handle streams with different namespace but the same name, i.e. they should all use test_stream
as the name
@@ -53,6 +54,9 @@ abstract class S3V2WriteTest( | |||
expectedRecordMapper, | |||
additionalMicronautEnvs = S3V2Destination.additionalMicronautEnvs, | |||
micronautProperties = S3V2TestUtils.assumeRoleCredentials.asMicronautProperties(), | |||
defaultNamespaceProvider = object: DefaultNamespaceProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now - I'll probably do some refactoring in this region later
I.e. as part of https://github.com/airbytehq/airbyte-internal-issues/issues/11543, I can probably combine the config-modifier with this thing. And then we would have two impls provided by the CDK, rather than one per destination. Curious what you think of approximately this:
class NullNamespaceIsValid {
fun setDefaultNs(config, randomNs) {}
fun getDefaultNs(randomNs) = null
}
abstract class NullNamespaceIsInvalid {
const val DEFAULT_NS_PREFIX = "_defaultns"
// contract is to set the default namespace to randomNs + DEFAULT_NS_PREFIX
abstract fun setDefaultNs(config, randomNs)
fun getDefaultNs(randomNs) = randomNs + DEFAULT_NS_PREFIX
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two? What's gained by this versus having one method that's just saying "tell us what to do when the namespace is null?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b/c the missing functionality is telling the connector what to do when the namespace is null. I.e. being able to modify the config.
and at that point, I think there's exactly two valid behaviors?
- the s3 way (default NS is just null, and modifying the config is a noop)
- the db/dw way (default NS is based on the randomized NS, and modifying the config involves doing some JSON munging)
7792525
to
228f44d
Compare
228f44d
to
9f028fe
Compare
9f028fe
to
8780708
Compare
8780708
to
4069e84
Compare
What
Adds tests for
@edgao the null namespaces break glue as well. Not sure if that's a possible scenario for you