In Bigquery write introduce method "fetchSchemaFromObject" which will dynamically generate schema json from the supplied POJO class.
BigQueryIO.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)
hey @nivedha1 could you share more context on why schema needs to be generated here, .fetchSchemaFromObject(Person.class) when Person object is directly used.
What would you like to happen?
In Bigquery write introduce method "fetchSchemaFromObject" which will dynamically generate schema json from the supplied POJO class. BigQueryIO.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));
Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
Issue Components