kberezin-nshl commented on PR #32153:
URL: https://github.com/apache/beam/pull/32153#issuecomment-2379649770

   Hey, @wattache @lukas-mi 
   
   Unfortunately, currently there is a bug causing the behavior that you're 
seeing. [The fix for that](https://github.com/apache/beam/pull/32450) has been 
merged already, so hopefully you'll be able to use this feature with the next 
release.
   
   In the meantime, it is possible to have the following workaround, first 
create this class:
   ```java
   public class WorkaroundBQServices implements BigQueryServices {
   
     private final String bigQueryEndpoint;
   
     public WorkaroundBQServices(String bigQueryEndpoint) {
       this.bigQueryEndpoint = bigQueryEndpoint;
     }
   
     @Override
     public JobService getJobService(BigQueryOptions options) {
       options.setBigQueryEndpoint(bigQueryEndpoint);
       return new BigQueryServicesImpl.JobServiceImpl(options);
     }
   
     @Override
     public DatasetService getDatasetService(BigQueryOptions options) {
       options.setBigQueryEndpoint(bigQueryEndpoint);
       return new BigQueryServicesImpl.DatasetServiceImpl(options);
     }
   
     @Override
     public WriteStreamService getWriteStreamService(BigQueryOptions options) {
       options.setBigQueryEndpoint(bigQueryEndpoint);
       return new BigQueryServicesImpl.WriteStreamServiceImpl(options);
     }
   
     @Override
     public StorageClient getStorageClient(BigQueryOptions options) throws 
IOException {
       options.setBigQueryEndpoint(bigQueryEndpoint);
       return new BigQueryServicesImpl.StorageClientImpl(options);
     }
   }
   ```
   
   then in your pipeline, set it as
   ```java
   BigQueryIO.<...>write()
               .withTestServices(new 
WorkaroundBQServices(options.getBigQueryEndpoint()))
   ```
   
   As I said, once new release come out, you should be able to remove this 
workaround.


-- 
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]

Reply via email to