Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

google cloud platform - Importing Entities Into Local GCP Datastore Emulator

I was able to export entities into a storage bucket without much difficulty with this command:

gcloud datastore export --kinds="KIND1,KIND2" --namespaces="NAMESPACE1,NAMESPACE2" gs://${BUCKET}

And according to the docs importing can be done like this:

gcloud datastore import gs://${BUCKET}/[PATH]/[FILE].overall_export_metadata

or like this:

curl 
-H "Authorization: Bearer $(gcloud auth print-access-token)" 
-H "Content-Type: application/json" 
https://datastore.googleapis.com/v1/projects/${PROJECT_ID}:import 
-d '{
"inputUrl": "gs://'${BUCKET}'/[PATH]/[FILE].overall_export_metadata",
}'

My datastore emulator is running on localhost:8081 is there anyway I can use this curl command to import the data to the emulator? There's nothing in the docs about it and I've tried guessing many urls but nothing works.

If this is impossible, is there another way I can fill my local emulator or better yet connect the local app engine to the production datastore?

Apparently there used to be a way to export and import using csv files:

Google cloud datastore emulator init data

but that has since been deprecated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...