Support for sub schemas and unknown logical types
See original GitHub issueI am debating adding support for “schema” types and “unknown” logical types. I’m thinking of using fastavro for some avro data I have. It’s change data from a database, so there are two scenarios here that fastavro doesn’t like. The example here:
{
"name":"special_nullable_string",
"type": ["null", {
"type":"string",
"logicalType":"varchar",
"metadata":30 } ]
}```
The first is having a logicaltype of "varchar" for a string base type. The second is having a subschema as a type, which is perfectly valid avro (this is how you get an avro schema that is not flat).
Would this be a welcome addition, and if so, I believe the reader is easy (I've already written two tests I'll add in a comment here) but the writer is escaping my immediate thoughts. Any pointers on how to best approach that would be appreciated.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Creating and managing schemas | Cloud Pub/Sub ...
A Pub/Sub schema defines the names and data types of fields in a message's data field. You can create schemas as standalone versioned...
Read more >GraphQL schema basics
Supported types. Every type definition in a GraphQL schema belongs to one of the following categories: Scalar; Object. This includes the three special...
Read more >Apache Avro™ 1.8.2 Specification
Avro supports six kinds of complex types: records, enums, arrays, maps, ... Permitted values depend on the field's schema type, according to the...
Read more >Formats, Serializers, and Deserializers
Support for schema references is provided for out-of-the-box schema formats: Avro, JSON Schema, and Protobuf. Schema references use the import statement of ...
Read more >Using a PostgreSQL database as an AWS DMS source
AWS DMS supports change data capture (CDC) using logical replication. ... AWS DMS streams some data types as strings if the data type...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@todpunk Looks like the fix will take a bit of time,
validate
function needs to be updated or how thewrite_union
function, since it’s usingvalidate
. I’ve already had an idea around this for a month now because I wanted to make changes to how validation works anyways, but this may take a few days.@todpunk your most recent schema is broken, I just pasted that code in Schema Registry and it got rejected, looks like you are missing a closing bracket ‘}’ between “name” and “address” field.
@scottbelden I’ll see if I can get the writer and reader updated sooner with the extra logic around logical_type. If anything the logicalType should default to the standard type if the logicalType doesn’t exist in the “Known” logicalTypes. This will also help with #173 which should just be a function “registers” to the LOGICAL_READERS and LOGICAL_WRITERS, if the writer or reader functions are left out, then it should refer to the base type.