Bookworm-project / BookwormDB

Tools for text tokenization and encoding
MIT License
84 stars 12 forks source link

Adding function to create new database #72

Open tpmccallum opened 9 years ago

tpmccallum commented 9 years ago

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

tpmccallum commented 9 years ago

Please don't hesitate to ask any questions, really appreciate the product guys. Tim