CYBER WEEK - EXTRA SAVINGS EVENT
TRY A FREE LESSON

Why Does 'Run Code' Always Throw The Same Error?

Screen Link:

As I am doing the Building and Organizing Complex Queries Mission, whenever I hit Run Code, it always throws the same error:

(sqlite3.OperationalError) table customer_usa already exists
[SQL: CREATE VIEW chinook.customer_usa AS       SELECT * FROM chinook.customer      WHERE country = "USA";]
(Background on this error at: http://sqlalche.me/e/13/e3q8)

What’s even stranger is that if I have the correct answer queued up and hit ‘Run Code’ it stills throws the same error but when I hit ‘Submit Answer’ it accepts it as correct.

Thats fine for the simple answers but here I am on Step 6 and trying to experiment (learn) as I am writing the answer and I can’t see what the outcome is because ‘Run Code’ throws and error every time.

Because of this I can’t see the results of the query that I am building to answer the question as I am doing it step by step on my own.

Is this some kind of bug or am I doing something wrong?

** UPDATE ** DQ has logged this as a bug on their end ** UPDATE **

2 Likes

Hmm… Does seem to be a bug on their end.

You can use the ? in the top-right corner of the Mission Step page to report this to them.

2 Likes

@gosaints
I do not know exactly what the issue is. I got the same error, but hit the submit answer button you can see the answer and move on to the next step. Hope this helps.

2 Likes

There only can be one view of the same table name.

You have create the view of the same table name.

To fix the problem, you need to drop the view if you have created before.

DROP VIEW IF EXISTS table_name
CREATE VIEW table_name ...

The code snippet above is based on sqlite. Other database SQL syntax may differs. Use with caution. And, whenever in doubt, consult documentation.

The process on which Run Code and Submit Answer may differ. Based on your observation,

  • Run Code does not perform DROP VIEW operation. This may be intended for learning purpose to educate oneself on why the error happens. Whenever there’s an error, you learn something.

  • Submit Answer does perform DROP VIEW operation without explicitly informing the user. Or Submit Answer reset the current working environment. Hence, the view was never created in the first place.

2 Likes

I am having the same issue as the other users above. I have tried dropping the ‘customer_usa’ table multiple times and receive the same message “table customer_usa already exists”.

I have also tried to run the code ‘DROP VIEW IF EXISTS’ as suggested and received the same error message as before.

2 Likes

Hey @gosaints, @mohngelay.nl, @ryan.pikulski,

You can do the following to help report the issue to DQ to fix

At the meantime, suggest to submit the answer using Submit Answer and move forward with other mission.

Hey @Sahil,

Can you take a look at mission - some bugs in the mission.

  • Run Code does not work anymore.
  • Submit Answer works.
2 Likes

Thanks for the responses everyone, I reported this to DQ and they logged it as a bug on their end.

2 Likes

Any way we can get an ETA on this getting fixed? @nityesh

1 Like

Hi @landcow,

Most probably this will be fixed by the end of next week.

Best,
Sahil

3 Likes

I only got this error when I press ‘Run code’. When I press ‘Submit Answer’ everything is ok

1 Like

Update:
Our engineering team deployed a fix for this issue. While it solved the previous issue, we are getting a new error:
(sqlite3.OperationalError) unrecognized token: "#"

So the screen is not fixed yet. Until this is fixed, I would suggest using the Submit Code button to run code on screens 4, 5, and 6. I will keep you updated.

Best,
Sahil

1 Like

Is there any update on this? I am still getting this error (sqlite3.OperationalError) unrecognized token: “#”