Support Questions
Find answers, ask questions, and share your expertise

Change data type of a field in schema registry

Change data type of a field in schema registry

New Contributor

Is it possible to change the type of a field in the schema registry? I created a schema in the registry, and it defaulted to backward compatibility. Right after I created it, I realized I mis-labeled one of the field types as a "long" when it was supposed to be "string." So

{"name": "Emp_ID", "type": "long" }

should instead be

{ "name": "Emp_ID", "type": "string"}

Since the schema is set to backward compatibility, if I try to create a new version with the updated type, I get an error "reader type:STRING not compatible with writer type:LONG" so I'm unable to update the schema. Since there's not really a great way to delete schemas from the registry (aside from logging directly into the backing SQL database), I was hoping to be able to update the schema so it is still usable, rather than have a bunch of junk schemas that I can't use anymore.

A colleague of mine said that with the confluent schema registry, they will disable compatibility checks, publish the new schema and then re-enable the compatibility as necessary. Is there a way to do something similar with Hortonworks Schema Registry? I haven't seen any setting that would allow me to change the compatibility mode.

Thanks

2 REPLIES 2

Re: Change data type of a field in schema registry

New Contributor

I don't see any replies to this question and I have the same question. Not being able to correct errors seems to be a pretty unworkable approach. Any guidance on what can and can't be changed when versioning a Schema would also be of help.

Re: Change data type of a field in schema registry

To change datatype or column names you need to use DISABLE as seen below:

 

Screen Shot 2020-01-04 at 11.17.18 AM.png