Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reuse datastore models across services without symlink

If App Engine service A and service B both depend on a datastore model, is there an effective way to share that model between both services without either duplicating the model or symlinking the file the model class definition is declared in?

Would like to hear anyone's experience with this. Maybe storing the shared dependencies in Cloud Storage and pulling the relevant files from there?

like image 503
yoonjesung Avatar asked Oct 20 '25 13:10

yoonjesung


1 Answers

Not really an answer, just some considerations.

I see a few difficulties to consider if using GCS for storing the shared models:

  • importing the models in your app code would be a bit more complex, you'll need to use GCS libraries to read the file(s) for dynamic importing as they would not be available in the local filesystem. As a side effect of the dynamic importing you may loose some development capabilities in your IDE (like auto-completion, object structure verifications, etc) Preserving them might be possible, but probably not trivial.

  • splitting the model definitions across model files (for partial reuse, inheritance and/or inter-model references for example) would not be a simple task. The point above would need to be addressed in the model files as well, in addition to the application code.

  • deploying the app code on GAE and the models on GCP will always be non-atomic, extra care for coordinating the deployments and probably backward/forward compatibility would be needed to minimize/eliminate transient failures.

IMHO the symlinks would be a simpler approach.

like image 135
Dan Cornilescu Avatar answered Oct 22 '25 03:10

Dan Cornilescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!