question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for sub schemas and unknown logical types

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rhaarmcommented, May 1, 2018

@todpunk Looks like the fix will take a bit of time, validate function needs to be updated or how the write_union function, since it’s using validate. 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.

1reaction
rhaarmcommented, May 1, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found