pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models
https://pastastore.readthedocs.io
MIT License
15 stars 4 forks source link

Storing oseries to models relationship #50

Closed dbrakenhoff closed 2 years ago

dbrakenhoff commented 2 years ago

The latest PR #49 adds functionality to keep track of models per oseries. This is useful to keep track of, e.g. for getting a list of models for a certain location. The downside of the current implementation is that it requires a run through all stored models to build this dictionary, which can take a few seconds when creating a Connector object linking to an existing database.

This issue is a reminder to maybe think about a faster more efficient way to keep track of this, i.e. store this relationship in a separate library that is updated with each add_model() and del_model() call. This avoids having to rebuild this dictionary each time you connect to the database. Or perhaps another solution...?

dbrakenhoff commented 2 years ago

New proposed solution to this problem. Still a bit of a work in progress and I'm not sure whether this is the way to go yet.

Upsides:

There are some performance downsides to this implementation, but I'm not sure if they're really noticeable in practice...

Downsides:

dbrakenhoff commented 2 years ago

A different proposed solution is presented in #68. This implementation creates a new library oseries_models where the relationship between models and oseries will be stored.

Upsides:

Downsides:

dbrakenhoff commented 2 years ago

Added in #62, closing issue.