datacamp / sqlwhat

https://sqlwhat.readthedocs.io
GNU Affero General Public License v3.0
3 stars 8 forks source link

Adding test_ncols to check_result #95

Closed colinricardo closed 7 years ago

colinricardo commented 7 years ago

Overview

Currently check_result() will pass if the columns in the student submission are some superset of the columns in the solution.

This means that

SELECT *
FROM films;

will pass, when the desired solution is:

SELECT title, release_year
FROM films;

Enhancement Request

Adding test_ncols() to check_result() so the number of columns in student submission must match the number of columns in the solution code. I would argue that this is desirable default behavior, but it's up for discussion: cc @ncarchedi

machow commented 7 years ago

This was already discussed when testing the microsoft sql course, and it was decided to remove test_ncols from check_result.

We can't keep putting things into a simple, high level SCT and then removing it due to the whims of single course needs. @filipsch and I worked out a simple mechanism that will let you specify an SCT function at the course level, and then you can put whatever you want in it. It's already implemented, just needs to be put into production--I'll do it when we work on SCT stuff this week.

(This way, individual courses can have the behavior you're asking for, and then if they all end up using that behavior, we can pull it into sqlwhat)

machow commented 7 years ago

Reviewed https://github.com/datacamp/sqlwhat-ext with @colinricardo , which includes this behavior (long live check_result2!).