Feature 267 db engine - #270
Merged
Merged
Conversation
With this commit the bulk download works by only using the self._engine parameter. However the API still needs to be adapted.
This needs to be done if we want the docker-compose file to be part of the python package.
Additionally, the setup_docker function was moved to a helpers module.
We need it in the open_mastr folder if it shall be part of the python package.
In the usual workflow, the engine is created at initialization of a Mastr object. This engine then needs to be passed to the MastrMirror object from the soap API.
test_helpers
* The references contains information about engine parameter * Configuratin description adapted * Black applied on helpers * TODO: Describe docker-postgres, once it works * TODO: Update changelog
FlorianK13
marked this pull request as draft
June 22, 2022 10:45
FlorianK13
marked this pull request as ready for review
June 23, 2022 06:06
chrwm
reviewed
Jun 24, 2022
| When using `download(method="API")`, the data is retrieved from the MaStR API. For using the MaStR API, | ||
| credentials are needed (see :ref:`Get data via the MaStR-API`). By using the API, | ||
| additional parameters can be set to define in detail which data should be reveived. | ||
| additional parameters can be set to define in detail which data should be reviewed. |
Member
There was a problem hiding this comment.
Suggested change
| additional parameters can be set to define in detail which data should be reviewed. | |
| additional parameters can be set to define in detail which data should be obtained. |
| @@ -1,10 +1,8 @@ | |||
| from datetime import date, datetime | |||
| from datetime import date | |||
Member
There was a problem hiding this comment.
Clear commit message that fits changes, nice and easy to review!
Comment on lines
+67
to
76
| def validate_parameter_format_for_mastr_init(engine) -> None: | ||
| if engine not in ["sqlite", "docker-postgres"]: | ||
| if not isinstance(engine, sqlalchemy.engine.Engine): | ||
| raise ValueError( | ||
| "parameter engine has to be either 'sqlite' " | ||
| "or 'docker-postgres' or an sqlalchemy.engine.Engine object." | ||
| ) | ||
|
|
||
|
|
||
| def validate_parameter_format_for_download_method( |
Comment on lines
+194
to
+197
|
|
||
| for engine in engine_list_failing: | ||
| with pytest.raises(ValueError): | ||
| validate_parameter_format_for_mastr_init(engine) |
Member
There was a problem hiding this comment.
Is this implementation resulting in a test failure for all other values apart from ["sqlite", "docker-postgres", db._engine] and not only a failure for ["HI", 12] ?
Member
Author
There was a problem hiding this comment.
Yes, but it is hard to test for such a large amount of failing values, so I just chose an exemplary string and integer value that makes the code fail.
Comment on lines
+57
to
+61
|
|
||
| * slqite: This database will be stored in `$HOME/.open-MaStR/data/sqlite`. | ||
| * docker-postgres: A docker container of a PostgreSQL database. | ||
| * own database: The Mastr class accepts a sqlalchemy.engine.Engine object as engine which provides the user to | ||
| use any other desired database. |
Co-authored-by: chrwm <54852694+chrwm@users.noreply.github.com>
Member
Author
|
@chrwm Can we merge the branch now? Because Deniz and me want to do a restructuring session later today and it would be best if this branch is already merged then. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Created an engine parameter at Mastr init(). This parameter decides which database is used.