GangLiCN opened a new issue, #6462:
URL: https://github.com/apache/seatunnel/issues/6462

   ### Search before asking
   
   - [X] I had searched in the 
[feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22)
 and found no similar feature requirement.
   
   
   ### Description
   
   When testing  data sync from  Kafka to any sink database(e.g. Mysql, PG, 
clickhouse,,.etc), I find an "issue" and it 
   may need to be enhanced.
   
       The issue is that:  the default key/value's deserializer when cosuming 
   Kafka records is [ByteArrayDeserializer] , Which means no matter you 
override  
   "kakfa.config"  or use default property  in your job configuration file  the 
returned 
   data is byteArrays's binding(key,value).   
   
        This implement looks like a bit inconvenient because  byeArrary is not 
a 
   standard  datatype in most polular databases and user must convert it 
   before writing data into database.
   
   
   ### Usage Scenario
   
   A simple example configuration file is as below:
   
    
   # Defining the runtime environment
   env {
     # You can set flink configuration here
     execution.parallelism = 4
     job.mode = "STREAMING"
   }
   
   source{
     Kafka {
       format = json    
       topic = "sensor_data"
       bootstrap.servers = "localhost:9092"
       result_table_name = "middle_sensor_tbl"
       
       schema = {
         fields {
           id = "string"
           timestamp = "bigint"
           temperature_c = "decimal(38,20)"
         }
       }
       start_mode = "earliest"
       
       kafka.config = {
         auto.offset.reset = "earliest"
         enable.auto.commit = "true"
         max.poll.records = "1000"
         session.timeout.ms = "60000"
         key.deserializer = 
org.apache.kafka.common.serialization.StringDeserializer
       }
     }
   }  
   
   
   transform {
       # If you would like to get more information about how to configure 
seatunnel and see full list of transform plugins,
       # please go to https://seatunnel.apache.org/docs/transform-v2/sql
   }
   
   # query = "insert into sensor_data(id, timestamp, temperature_c) 
values(?,?,?)" 
   sink {
     
     jdbc {
       source_table_name = "middle_sensor_tbl" 
       url = "jdbc:postgresql://localhost:6982/seatunnel_test"
       driver = "org.postgresql.Driver"
       database ="seatunnel_test"
       user = "seatunnel_test"
       password = "seatunnel_test_123"
       table = "sensor_data"
       batch_size = 10000
       primary_keys = ["id"]
       query = "insert into sensor_data(id, timestamp, temperature_c) 
values(?,?,?)" 
     }
   }
   
   ### Related issues
   
   No
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to