Skip to content
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

Bug: materialize_source_kafka allows incompatible format and key_format options #654

Open
bobbyiliev opened this issue Sep 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bobbyiliev
Copy link
Contributor

What version of the Materialize Terraform provider are you using?

v0.8.8

What version of the Terraform CLI are you using?

v1.9.5

What version of Materialize are you using?

v0.117.0

What is the issue?

@sthm noticed that the Terraform provider allows you to specify format and ket_format options which are incompatible:

image

This results in the following error:

│ Error: ERROR: Expected end of statement, found KEY (SQLSTATE 42601)

To reproduce:

resource "materialize_source_kafka" "json_source" {
  name         = "avro_source"
  topic        = confluent_kafka_topic.topic.topic_name
  schema_name  = materialize_schema.public.name
  cluster_name = materialize_cluster.default.name
  kafka_connection {
    schema_name = materialize_schema.public.name
    name        = materialize_connection_kafka.confluent_cloud.name
  }
  format {
    json = true
  }
  key_format {
    json = true
  }
  envelope {
    upsert = true
  }
  include_key = true
}

We should extend the schema for the Kafka source and include a ConflictsWith for the format attribute so that it can not be used together with the key_format and value_format attributes.

@bobbyiliev bobbyiliev added the bug Something isn't working label Sep 17, 2024
@sthm
Copy link

sthm commented Sep 17, 2024

Thanks for filing the issue, Bobby! In addition to the conflict between format and key_format, the usage of

  format {
    json = true
  }

actually requires key_format and value_formatto be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants