Skip to content

Add patterns for making databases #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hancush opened this issue Jan 5, 2018 · 3 comments
Open

Add patterns for making databases #17

hancush opened this issue Jan 5, 2018 · 3 comments

Comments

@hancush
Copy link
Member

hancush commented Jan 5, 2018

We've got great documentation for generating files, but we could use more detail about a concise and Make-ish approach for building databases, e.g., writing SQL-heavy Makefiles. A really great example lives over in datamade/school-report-cards.

Most notably, it involves this handy lil' Make function for checking if a table exists before trying to create it that allows you to include database-level recipes in your overall flow without using dummy .table files or having things break all the time.

Let's add a Makefile 301 (since database-building seems to be a non-standard application of Make), or a database-specific appendix, documenting some good patterns. (I'm happy to take the lead!)

(We should link to the school-report-cards repo in the code examples, too!)

@ghing
Copy link

ghing commented Aug 8, 2018

I've taken this approach before. I'm curious why you prefer this approach to dummy files.

@hancush
Copy link
Member Author

hancush commented Aug 8, 2018

@ghing dummy files are sometimes created even if your database operation fails, which creates an incorrect picture of dependency existence. they also clutter up the working directory. both are hacky, i.e., i wouldn’t call one more “correct,” but as a matter of which has been less annoying to contend with for me, i’ll go with checking the db (almost) every time. have you had issues with this approach?

@ghing
Copy link

ghing commented Aug 8, 2018

@hancush That makes sense. I didn't have any issues with the approach, I think it just felt dirty to hit the db so frequently, and to re-run recipes for targets, even though they existed. For a recent project, I went the dummy file approach, and I'll see if that ends up feeling bad also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants