Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

make DBCreator class implement fluent interface #84

Closed
lsloan opened this issue Apr 9, 2020 · 1 comment · Fixed by #110
Closed

make DBCreator class implement fluent interface #84

lsloan opened this issue Apr 9, 2020 · 1 comment · Fixed by #110
Assignees
Labels
📈 enhancement New feature or request

Comments

@lsloan
Copy link
Member

lsloan commented Apr 9, 2020

For convenience, make the DBCreator class implement a fluent interface. In its most basic form, this means all the class' methods that currently return None would instead return the instance of DBCreator (i.e., self).

Such an interface would allow code like this:

    db_creator_obj = DBCreator(INVENTORY_DB, APPEND_TABLE_NAMES)
    db_creator_obj.set_up()
    db_creator_obj.drop_records()
    db_creator_obj.tear_down()

To be written as this instead:

    db_creator_obj = (DBCreator(INVENTORY_DB, APPEND_TABLE_NAMES)
        .set_up().drop_records().tear_down())
@lsloan lsloan added the 📈 enhancement New feature or request label Apr 9, 2020
@ssciolla
Copy link
Contributor

ssciolla commented Apr 9, 2020

Makes sense. I'll try to handle this with some other changes I've been looking at to this class.

@ssciolla ssciolla self-assigned this Apr 9, 2020
@ssciolla ssciolla linked a pull request Apr 22, 2020 that will close this issue
3 tasks
ssciolla added a commit that referenced this issue Apr 28, 2020
* Implement fluent interface; fix mypy issues; rename set_up, tear_down as connect, close; update uses; set up default append tables

* Remove metadata tables from env_blank.json

* Remove page_num condition

* Update APPEND_TABLE_NAMES

* Remove close, connect; update var names; make other tweaks

* Update DBCreator references

* Remove conn instance variable

* Remove page_num condition again

* Remove unused imports

* Update default append table names var name
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📈 enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants