Hello community,
I’m facing below error while trying to read BQ table data using storage read api
FAILED_PRECONDITION: request failed: Failed to convert table schema to Avro record schema. field name column with space, error Invalid name:column with space
Note: column with space is name of a column in my table.
This error doesn’t occur when the column names do not have a space.
My Questions
- Does Avro format support a column name with space?
- Is there a way to retrieve data for my table data that contains a column like column with space using storage read api ?
Artifact: Code snippet
String tableReference = "projects/myproject/datasets/mydataset/tables/mytable";
ReadSession.TableReadOptions.Builder options = ReadSession.TableReadOptions.newBuilder();
options.addSelectedFields("column1");
options.addSelectedFields("column2");
options.addSelectedFields("column with space");
ReadSession.Builder sessionBuilder =
ReadSession.newBuilder()
.setTable(tableReference)
.setDataFormat(DataFormat.AVRO)
.setReadOptions(options);
CreateReadSessionRequest createReadSessionRequest =
CreateReadSessionRequest.newBuilder()
.setParent("projects/myproject")
.setReadSession(sessionBuilder)
.setMaxStreamCount(4)
.build();
ReadSession session = readClient.createReadSession(createReadSessionRequest);
// process session.getStreamsList()
I’m getting the error while trying to createReadSession.
Artifact: Java SDK version
"com.google.cloud:google-cloud-bigquerystorage:3.2.0"
"com.google.cloud:google-cloud-bigquery:2.5.1",
I appreciate any help here.
Thanks