Skip to content
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

Recipe required for testing all database views in specified database #3

Open
adrianyorke opened this issue Feb 28, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@adrianyorke
Copy link
Owner

Database views should be regularly tested to ensure that they are still functioning. Views are effectively a SELECT statement that queries data from database tables and other views. The underlying tables and join conditions that the view depends on can be modified in a way that breaks existing views if they have not been refactored in line with new db structure.

First, it is necessary to query the database catalog and loop through all database views that exist. For each view discovered, a simple "SELECT TOP 1 * FROM <database_view>;" will be sufficient to check that the view logic is still functioning. This technique should work even if there is no data loaded.

@adrianyorke adrianyorke added the good first issue Good for newcomers label Feb 29, 2020
@ericbjones
Copy link
Collaborator

This one sounds fun and is pretty well defined already, but we could also add a suggested sample database to test against in the description (as just an optional, but useful suggestion to the developer). I propose the Sakila sample database from MySql : https://dev.mysql.com/doc/sakila/en/ . Nice thing about this sample db is its well documented at that link and it even contains install instructions. This database has seven views in it, so that will work perfectly for dev on this recipe, and it has a lot of other features so it will work nicely for pretty much any db recipies we make.

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

No branches or pull requests

2 participants