Please consider offering answers and suggestions to help other students!
And if you fix a problem by following a suggestion here,
it would be great if other interested students could see a short
"Great, fixed it!" followup message.
Hi,
In question 3 of lab 5, I have managed to write a code which has correct expected results for 3/4 tests. However, one of the test is:
DELETE FROM po_items WHERE job_id = '002' AND po_id = 'HHH';
DELETE FROM pos WHERE job_id = '002' AND po_id = 'HHH';
SELECT * FROM pos WHERE job_id = '002' AND po_id = 'HHH';
Is the first line of code an error, where it is meant to be pos instead of pos_item?
The expected result is that no trigger should be evoked however my trigger is evoked for this test. If someone could clarify this it would be great.
Thank you.
Hey, I am getting 2 of the tests wrong.
I think there is an issue with the question.
I am getting the answer, but the message is not exactly the same with the expected output.
I get my output as "Unexpected sqlite3 error: Error: near line 14: " and in the expected output it is "Trigger failed as expected due to related po_items". Because of this it is not working.
That is the internal abort error stack coming from sqlite itself, I think.
I have attached a screenshot as well.
It would be great if the issue is resolved.
Regards,
Kushan
I was initially getting the question wrong because the actual output of my abort gave a different line number to the abort on the expected output. In my case, the expected line output was 12 while I was initially outputting an error code with line 11.
I just added a nonsensical extra line in my trigger to get the question correct
You're missing a full stop at the end of your error message, not including it creates the unexpected sqlite3 error as the testing system is looking for the full stop.
They seem to have not included the full stop in the actual question.
Maybe I'm reading your screenshot wrong, but to me it looks like they've changed the question to need no full stop. If that still doesn't work, maybe try changing the amount of lines your query is so that the error is on line 12 like how it is expected in the screenshot
The issue should be fixed, removing any reference to line numbers, you should now get:
Trigger failed as expected due to related po_items: Cannot delete pos record with associated po_items
job_id po_id po_date vendor_id
---------- ---------- ---------- ----------
002 HHH 1990-06-20 ABC
The Python code in the question was not correctly identifying the error message and intercepting it.
I just had a student come to the support session showing that there was still issues with the way the question was checked, and if your instance of the quiz is for some reason using an older version of the question, and does not have the same error message as above (Trigger failed as expected due to related po_items: Cannot delete pos record with associated po_items), but rather has line numbers referenced, but that is the only issue, then i can suggest that you try to adjust the number of lines the trigger takes up, e.g. is the error message displayed compared to the expected is 4 lines off, then shorten the size of the query you submit by 4.
you can safely do this by having lines of code that you would normally separate for better visibility all on one line e.g.
SELECT * FROM STUDENTS;
instead of
SELECT *
FROM
STUDENTS;
SQL will ignore the majority of whitespace anyway, and it is primarily for readability and separating the commands.