pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models

Home Page:https://pastastore.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PastaStore and Connector names and logical defaults

dbrakenhoff opened this issue · comments

The PastaStore object now takes a name, which is not something that's really used, so we could default to the connector name and optionally let users pass their own.

The Connectors now take a name and some take a path/connection string. This is not implemented consistently, and also doesn´t make sense for all connectors.

  • ArcticConnector requires a unique name to create a library with that name.
  • PystoreConnector I think also requires a name to create a database in a certain folder.
  • PasConnector requires a path but does not use the name, it would probably make more sense to pass a directory in which a folder with the provided name is created, more in line with the other two connectors.
  • DictConnector takes a name argument for consistency reasons but my proposal would be to set a default name.

I'm not sure how to make these changes without breaking some old code (for PasConnector), but I think would be good to implement sooner rather than later.

This is now dealt with in #88.

  • DictConnector now gets a default name and doesn't necessarily need to be passed by user. It's not used for anything anyway, so a default value makes creating a DictConnector easier.
  • PasConnector now actually uses the name argument as the name of the directory in which the data will be stored. The path argument is now the location where to create/read that directory. This is a breaking change, see instructions below.
  • PastaStore now expects the Connector object as the first argument. The name argument is now optional, if it is not provided, it will take the name from the Connector object.

WARNING! This change will introduce two breaking changes:

  • This does introduce a breaking change, where people with old code will have to switch the order of the arguments from pst.PastaStore(name, connector) to pst.PastaStore(connector, name=name) with the name becoming optional.
  • Also in pst.PasConnector the name argument is now used to specify the directory name in which the database will be stored. The path argument defines the location of that directory. This is also a breaking change and will require users to modify their PasConnector from pst.PasConnector("unused_name", path="./pastas_db") to pst.PasConnector("pastas_db", path="."). This is more in line with the other Connectors.