Hi guys. I have a table in apache beam that has an auto increment id with a
sequence.






*CREATE SEQUENCE sap_tm_customer_id_seq;CREATE TABLE IF NOT EXISTS test (
 id bigint DEFAULT nextval('sap_tm_customer_id_seq'::regclass),   name
VARCHAR(10),   load_date_time TIMESTAMP);*

And i have the following pipeline to make the insert into the table:
with beam.Pipeline() as p:
  _ = (
      p
      | beam.Create(
        [

            ExampleRow(id=1,name='adsf', load_date_time='2023-04-05
12:34:55'),
            ExampleRow(id=3,name='adsf', load_date_time='2023-04-05
12:34:56')
        ]).with_output_types(ExampleRow)
      | 'Write to jdbc' >> WriteToJdbc(
          driver_class_name='org.postgresql.Driver',
          jdbc_url='jdbc:postgresql://localhost:5432/postgres',
          username='postgres',
          password='postgres',
          table_name= 'test',
          connection_properties="stringtype=unspecified",
          statement='INSERT INTO test \
                        VALUES(?,?,?) '
      ))

The problem is that I haven't been able to insert the register omitting the
id field into the pcollection in a way the database automatically assigns
the auto increment id.

Can you help me? I have spent a lot of time but i have not realize the
solution.

Thanks!!

Reply via email to