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

Bind variables cannot be used for table names #1310

Closed
5olitude opened this issue Feb 25, 2023 · 3 comments
Closed

Bind variables cannot be used for table names #1310

5olitude opened this issue Feb 25, 2023 · 3 comments

Comments

@5olitude
Copy link

how can I bind kafka values as bind variables for sink connector

@oscerd
Copy link
Contributor

oscerd commented Feb 25, 2023

Please explain a bit better what you're trying to do and maybe add some code and examples.

@5olitude
Copy link
Author

5olitude commented Feb 25, 2023

insert into table_name(id, name) values (?,?) : This is my query but I need to replace the table name along with kafka returned value , suppose if my kafka values are like this [table_name,id,name] how can I assign the table_name to the above query? Im using Cassandra sink connector

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: cassandra-sink-binding
spec:
  source:
    ref:
      kind: KafkaTopic
      apiVersion: kafka.strimzi.io/v1beta1
      name: my-topic
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: cassandra-sink
    properties:
      connectionHost: "cassandra.default.svc.cluster.local"
      connectionPort: "9042"
      keyspace: blobing
      query: "insert into (?) (id,datassd) values (?,?)"


@oscerd
Copy link
Contributor

oscerd commented Feb 27, 2023

This is not possible at this stage. The bind is just for values not for the table name. You could try to manipulate the table name through modifying the Kamelets and change the sink from to to toD, but it's conceptually wrong for Kamelets.

If you have multiple tables, you should have a kafka topic for each of them and consume with n kamelets one for each table. Kamelets are building blocks, not all the use cases could be covered.

@oscerd oscerd closed this as completed Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants