lukas-mi commented on PR #32153:
URL: https://github.com/apache/beam/pull/32153#issuecomment-2379149978
I've tried the following:
```
PipelineOptionsFactory.register(BigQueryOptions.class);
BigQueryOptions options =
PipelineOptionsFactory.create().as(BigQueryOptions.class);
options.setBigQueryProject(bqEmulator.getEmulatorHttpEndpoint());
options.setBigQueryProject(bqEmulator.getProjectId());
var pipeline = Pipeline.create(options);
var sinkTable = "%s.%s.%s".formatted(bqEmulator.getProjectId(),
"test_dataset", "test_table");
var schema = new TableSchema()
.setFields(List.of(new TableFieldSchema()
.setName("testColumn")
.setType("STRING")
.setMode("REQUIRED")));
var row = new TableRow();
row.set("testColumn", "testValue");
var rows = Create.of(List.of(row));
pipeline
.apply(rows)
.apply(BigQueryIO
.<TableRow>write()
.to(sinkTable)
.withFormatFunction(new
SerializableFunction<TableRow, TableRow>() {
@Override
public TableRow apply(TableRow input) {
return input;
}
})
.withSchema(schema));
pipeline.run().waitUntilFinish();
```
Still get the following error:
```
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad
Request
GET
https://bigquery.googleapis.com/bigquery/v2/projects/test-project/datasets/test_dataset?prettyPrint=false
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "The project test-project has not enabled BigQuery.",
"reason": "invalid"
}
],
"message": "The project test-project has not enabled BigQuery.",
"status": "INVALID_ARGUMENT"
}
```
--
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]