0
0
Kafkadevops~10 mins

Schema Registry concept in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to register a schema using Schema Registry client.

Kafka
schema_registry_client.register([1], schema)
Drag options to blanks, or click blank then click option'
Aregister
Bcreate_schema
Cadd_schema
Dregister_schema
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that do not exist in the client.
Confusing 'add_schema' with the correct method.
2fill in blank
medium

Complete the code to retrieve a schema by its ID from Schema Registry.

Kafka
schema = schema_registry_client.get_schema([1])
Drag options to blanks, or click blank then click option'
Aschema_id
Bsubject_name
Cschema_name
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using subject name instead of schema ID.
Confusing version with schema ID.
3fill in blank
hard

Fix the error in the code to check if a schema is compatible with the latest version.

Kafka
is_compatible = schema_registry_client.test_compatibility([1], schema)
Drag options to blanks, or click blank then click option'
Aschema_name
Bschema_id
Cversion
Dsubject
Attempts:
3 left
💡 Hint
Common Mistakes
Passing schema ID instead of subject name.
Using version number as the first argument.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps subject names to their latest schema versions.

Kafka
latest_versions = {subject: schema_registry_client.get_latest_version([1]) for subject in subjects if schema_registry_client.get_latest_version(subject) [2] 0}
Drag options to blanks, or click blank then click option'
Asubject
B>
C==
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong variable name for the key.
Using equality or less than instead of greater than in the condition.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps subject names to their schema IDs for schemas with version greater than 1.

Kafka
schema_ids = { [1] : schema_registry_client.get_schema_id([2], [3]) for [1] in subjects if schema_registry_client.get_version([2], [1]) > 1 }
Drag options to blanks, or click blank then click option'
Asubject
Cversion
Dsubject_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Passing subject name instead of version number.