Skip to content
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

DAT: verify that a destination is able to write any ISO8601-compliant date string #9816

Merged
merged 24 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
- name: Google PubSub
destinationDefinitionId: 356668e2-7e34-47f3-a3b0-67a8a481b692
dockerRepository: airbyte/destination-pubsub
dockerImageTag: 0.1.2
dockerImageTag: 0.1.4
documentationUrl: https://docs.airbyte.io/integrations/destinations/pubsub
icon: googlepubsub.svg
- name: Kafka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@
supported_destination_sync_modes:
- "append"
- "overwrite"
- dockerImage: "airbyte/destination-pubsub:0.1.2"
- dockerImage: "airbyte/destination-pubsub:0.1.4"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/destinations/pubsub"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2021 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.integrations.standardtest.destination;

import com.fasterxml.jackson.databind.node.ObjectNode;
import io.airbyte.protocol.models.AirbyteMessage;
import io.airbyte.protocol.models.AirbyteMessage.Type;
import java.util.List;
import java.util.Map;

public interface DateTimeConverter {
edgao marked this conversation as resolved.
Show resolved Hide resolved
edgao marked this conversation as resolved.
Show resolved Hide resolved

/**
* Search dateTimeFieldNames inside data from @messages and converts to connector-specific date or
* date-time format
*
* @param messages list with AirbyteMessage
* @param dateTimeFieldNames map where key - path to the date/date-time field (e.g.
* /parentField/field), value - "date" or "date-time" depends on the format from catalog.
*/
default void convertDateTimeFields(List<AirbyteMessage> messages, Map<String, String> dateTimeFieldNames) {
for (AirbyteMessage message : messages) {
if (message.getType() == Type.RECORD) {
convertDateTime((ObjectNode) message.getRecord().getData(), dateTimeFieldNames);
}
}
}

/**
* Search dateTimeFieldNames inside @data and converts to connector-specific date or date-time
* format
*
* @param data from message record
* @param dateTimeFieldNames map where key - path to the date/date-time field (e.g.
* /parentField/field), value - "date" or "date-time" depends on the format from catalog.
*/
default void convertDateTime(ObjectNode data, Map<String, String> dateTimeFieldNames) {}

/**
* Override this method and return 'true' if destination connector requires conversion for
* date/date-time fields for testSyncWithNormalization() method. Then override convertDateTime(..)
* method to convert data to specific date-time format
*
* @return true - if destination connector requires conversion for date/date-time fields, false - in
* the other case.
*/
default boolean requiresDateTimeConversionForNormalizedSync() {
return false;
}

/**
* Override this method and return 'true' if destination connector requires conversion for
* date/date-time fields for testSync() method. Then override convertDateTime(..) method to convert
* data to specific date-time format
*
* @return true - if destination connector requires conversion for date/date-time fields, false - in
* the other case.
*/
default boolean requiresDateTimeConversionForSync() {
return false;
}

/**
*
* @param path path to field e.g /field1/nested_field
* @return true if the path consists of only one field (e.g /someField)
*/
default boolean isOneLevelPath(String path) {
return path.lastIndexOf("/") == 0;
}

}
Loading