Adding function to create new database #72
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.
I have added (by re-using some of the already existing code in the CreateDatabase.py file) a function which allows a new database to be created. I like the DB class and have therefore added a new function called createDatabase instead of writing new code elsewhere. The new function means that that a new database can be created (passing in new database name) instead of it being created through the existing function called "connect" which uses the self.dbname which was set in the constructor.
I deliberately did not change the existing functions or their signatures (arguments) to avoid side effects but rather created a new function "createDatabase" and added the existing "query" function from the BookwormSQLDatabase class (which already existed in the CreateDatabase.py file below my new changes).
I have tested this code on a fresh installation and it works great.
Overall just a little bit of extra functionality. I hope to do a lot more with Bookworm (write Python code to harvest OAI-PMH from various places) and would much prefer to stay with your code than fork and head in another direction missing out on your future development.
Kind regards
Tim