Hi, using flink-sql and the upsert-kafka connector...
# troubleshooting
a
Hi, using flink-sql and the upsert-kafka connector, is there a way to insert into avro kafka topic by using an existing schema, instead having to use a flink generated one? It is this problem from stackoverflow: https://stackoverflow.com/questions/76524654/flink-sql-automatically-uploads-avro-schema My table definition on top of Kafka Avro topic is like this and I can select events from that topic, but inserting into it always tries to register an incompatible flink generated schema:
Copy code
CREATE TABLE IF NOT EXISTS team_events (
                            key STRING,
                            addedBy ROW`value` STRING,
                            payload ROW<UserAdded ROW<createdAt BIGINT, teamId ROW`value` STRING, userId ROW`value` STRING>>,
                            PRIMARY KEY (`key`) NOT ENFORCED
                        ) WITH (
                            'connector' = 'upsert-kafka',
                            'topic' = 'team-events',
                            'properties.bootstrap.servers' = '${broker}',
                            'properties.group.id' = 'flink',
                            'value.format' = 'avro-confluent',
                            'value.avro-confluent.url' = '${schema-registry}',
                            'value.fields-include' = 'EXCEPT_KEY',
                            'key.format' = 'raw'
                        );
This is the schema that Flink tries to register:
Copy code
{
  "type": "record",
  "name": "record",
  "namespace": "org.apache.flink.avro.generated",
  "fields": [
    {
      "name": "addedBy",
      "type": [
        "null",
        {
          "type": "record",
          "name": "record_addedBy",
          "fields": [
            {
              "name": "value",
              "type": [
                "null",
                "string"
              ],
              "default": null
            }
          ]
        }
      ],
      "default": null
    },
    {
      "name": "payload",
      "type": [
        "null",
        {
          "type": "record",
          "name": "record_payload",
          "fields": [
            {
              "name": "UserAdded",
              "type": [
                "null",
                {
                  "type": "record",
                  "name": "record_payload_UserAdded",
                  "fields": [
                    {
                      "name": "createdAt",
                      "type": [
                        "null",
                        "long"
                      ],
                      "default": null
                    },
                    {
                      "name": "teamId",
                      "type": [
                        "null",
                        {
                          "type": "record",
                          "name": "record_payload_UserAdded_teamId",
                          "fields": [
                            {
                              "name": "value",
                              "type": [
                                "null",
                                "string"
                              ],
                              "default": null
                            }
                          ]
                        }
                      ],
                      "default": null
                    },
                    {
                      "name": "userId",
                      "type": [
                        "null",
                        {
                          "type": "record",
                          "name": "record_payload_UserAdded_userId",
                          "fields": [
                            {
                              "name": "value",
                              "type": [
                                "null",
                                "string"
                              ],
                              "default": null
                            }
                          ]
                        }
                      ],
                      "default": null
                    }
                  ]
                }
              ],
              "default": null
            }
          ]
        }
      ],
      "default": null
    }
  ]
}