Kassem Shehady
Kassem Shehady

Reputation: 760

Default datastore instance inside dataflow job

I am trying to call Google datastore inside dataflow job I am getting null instance

datastore = DatastoreOptions.getDefaultInstance().getService();

Upvotes: 0

Views: 240

Answers (2)

Kassem Shehady
Kassem Shehady

Reputation: 760

Try putting this code in the main function not inside dataflow Pipline.

Upvotes: 1

Vikas Kedigehalli
Vikas Kedigehalli

Reputation: 306

This could probably be a credential issue. Could you try this,

Credentials credentials = context.getPipelineOptions().as(GcpOptions.class).getGcpCredential();

Datastore datastore = DatastoreOptions.newBuilder().setCredentials(credentials).build().getService();

Upvotes: 1

Related Questions