-
Notifications
You must be signed in to change notification settings - Fork 0
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
[SSDP 192] Use the schema registry to derive a stream schema in the kafka source #7
base: master
Are you sure you want to change the base?
Conversation
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.
The tests are pretty comprehensive. But I have two questions;
- Have we tested using the schema registry in staging?
- Have we tested this with schema registry subjects that have references?
*/ | ||
private static final Map<String, List<String>> AVRO_TO_JSON_DATA_TYPE_MAPPING = Map.ofEntries( | ||
entry("null", List.of("null")), | ||
entry("boolean", List.of("boolean", "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.
Why are they translated to nullable fields? F.i. A boolean field on avro would not accept null as a value unless it's type is [boolean, null]
- afaik.
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.
You are right, we can map Avro and Json type one by one, if in Avro there are double options we can set double option in json too.
} | ||
|
||
public JsonNode convertoToAirbyteJson(String avroSchema) throws Exception { | ||
Map<String, Object> mapAvroSchema = mapper.readValue(avroSchema, new TypeReference<>() { |
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.
Airbyte provices a helper class that we can use to serialise/deserialise Json - io.airbyte.commons.json.Jsons.
* @return Map<String, Object> map with Json struct | ||
* @throws Exception | ||
*/ | ||
public Map<String, Object> convertoToAirbyteJson(Map<String, Object> avroSchema) throws Exception { |
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 a first version this is fine, but I do wonder if there is a library that provides a AvroSchema
class that we could use instead of a Map.
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.
One thing we can do is to extract the different paths to private methods, i.e. one to deal with lists, one with maps (records)
assertInstanceOf(AvroFormat.class, kafkaFormat); | ||
} | ||
|
||
// @Test |
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.
Could we remove commented lines?
|
||
ObjectMapper mapper = new ObjectMapper(); | ||
|
||
String avroSimpleSchema = """ |
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 wonder if we should move all this string literals to resource files to keep the test class a bit tidier.
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 agree, it's better. I'll do
|
I don't have permissions for the italian account. But I thought we were going to get rid of that account because it was created just for evaluation purposes. If that schema doesn't have type references, we should do a test with references. |
Ok, in Italy we have the permission to create topic and token. Can you give me the staging permissions so I can try them? |
ce55eac
to
8c39acb
Compare
67e2903
to
aa73cda
Compare
…rt for state and checkpointing. (#9)
aa73cda
to
40a6093
Compare
Implement a simply converto to avro in json schema and use it in the discovery method to getch the schema from Confluent Schema Registry
8c39acb
to
be7986f
Compare
aae7401
to
069e9af
Compare
f38d69f
to
ba32568
Compare
##What
Fetch the avro schema from schema registry for each topic and save the schema in the Airbyte Catalog.
##How
In the discovery method call a Schema Registry to fetch the correct schema message with an API Confluent, and after transform it in the Json format and save in the Airbyte Catalog.
Recommended reading order
x.java
y.python
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user?
For connector PRs, use this section to explain which type of semantic versioning bump occurs as a result of the changes. Refer to our Semantic Versioning for Connectors guidelines for more information. Breaking changes to connectors must be documented by an Airbyte engineer (PR author, or reviewer for community PRs) by using the Breaking Change Release Playbook.
If there are breaking changes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Actions
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.0.0.1
Dockerfile
has version0.0.1
README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog with an entry for the initial version. See changelog exampledocs/integrations/README.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Updating a connector
Community member or Airbyter
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
Connector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changes