beam icon indicating copy to clipboard operation
beam copied to clipboard

[Feature Request]: Add A Freature to get bigquery schema dynamically from a POJO class.

Open nivedha1 opened this issue 1 year ago • 0 comments

What would you like to happen?

In Bigquery write introduce method "fetchSchemaFromObject" which will dynamically generate schema json from the supplied POJO class. BigQueryIO.<Person>write() .to(tableSpec) .fetchSchemaFromObject(Person.class) ..withFormatFunction( (Person elem) -> new TableRow().set("name", elem.name).set("age", elem.age)) .withCreateDisposition(CreateDisposition.CREATE_IF_NEEDED) .withWriteDisposition(WriteDisposition.WRITE_TRUNCATE));

   /** Person.java class **/
   class Person { 
           String name;
            int age;
   }
  /**
      Parse Person Object and construct schema json.
  **/
  fetchSchemaFromObject(Object Person)

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • [ ] Component: Python SDK
  • [X] Component: Java SDK
  • [ ] Component: Go SDK
  • [ ] Component: Typescript SDK
  • [ ] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Infrastructure
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [ ] Component: Samza Runner
  • [ ] Component: Twister2 Runner
  • [ ] Component: Hazelcast Jet Runner
  • [ ] Component: Google Cloud Dataflow Runner

nivedha1 avatar Aug 25 '24 16:08 nivedha1