# Why is the database that tests are being run on in #AZ9 not available for debugging?

**URL:** <https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883>\
**Category:** Challenges\
**Tags:** challenge:sqlite\
**Created:** [November 11, 2024, 10:22am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883 "2024-11-11T10:22:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Convl](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/convl/32/2509_2.png) [@Convl](https://forum.codecrafters.io/u/Convl)\
**Post date:** [November 11, 2024, 10:22am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/1 "2024-11-11T10:22:03Z")

</div>

I’m stuck on Stage #AZ9 of the SQLite challenge. When I debug my code using the provided sample.db, it works exactly as it should, but when the tester runs it, it is unhappy with the values that my code puts out. However, since the database file that tests are being run on is no longer sample.db, but some file that I don’t have access to / that is being generated on your end for the purpose of the test, I can’t debug my code to see where the problem lies. I tried setting debug to true, and that yields slightly more information (i.e. what columns the testing table has and what values my code is expected to produce), but not enough to reproduce the problem locally.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 11, 2024, 10:33am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/2 "2024-11-11T10:33:54Z")

</div>

Hi @Convl, you can run `download_sample_databases.sh` in your repo to get more sample db files for debugging.

---

<div class="post-metadata">

**Author:** ![Convl](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/convl/32/2509_2.png) [@Convl](https://forum.codecrafters.io/u/Convl)\
**Post date:** [November 11, 2024, 10:47am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/3 "2024-11-11T10:47:21Z")

</div>

The sample databases that are available for download there are much larger and contain tables that span multiple pages. Reading such tables is a feature that only gets implemented in the later stages of the project. At #AZ9, tables still fit on a single page, like the ones in sample.db. The problem is that my code works for sample.db, but it does not work for the tables that are used for testing, and there seems to be no way of downloading those.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 11, 2024, 11:04am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/4 "2024-11-11T11:04:17Z")

</div>

Let me see if I can locate a copy of the db file we’re using for the test.

In the meantime, could you share more details on the specific errors you’re encountering?

---

<div class="post-metadata">

**Author:** ![Convl](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/convl/32/2509_2.png) [@Convl](https://forum.codecrafters.io/u/Convl)\
**Post date:** [November 11, 2024, 11:32am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/6 "2024-11-11T11:32:36Z")

</div>

I think the test database gets dynamically generated on every test run (or at least, there are a number of test databases and the tester picks one of them on each run?) - but any of the test databases would probably help in tracking down the error.  
The error message I get makes me think my program might be reading from a different column than the one that is intended. I actually tried changing my code so it would read from the column with the next-nighest or next-lowest index instead, but that didn’t help, either. I’ll paste you a log from the last test I ran here:  
remote: [tester::#AZ9] Creating test.db with table: watermelon  
remote: [tester::#AZ9] Columns in table: chocolate, vanilla, banana, grape, pistachio  
remote: [tester::#AZ9] $ ./your\_program.sh test.db “select chocolate from watermelon”  
remote: [your\_program] Logs from your program will appear here!  
remote: [your\_program] Kaylah  
remote: [your\_program] Lavada  
remote: [your\_program] Shanie  
remote: [your\_program] Darby  
remote: [your\_program] Anastasia  
remote: [your\_program] Madelynn  
remote: [tester::#AZ9] Expected exactly 4 lines of output, got: 6  
remote: [tester::#AZ9] Test failed

---

<div class="post-metadata">

**Author:** ![Convl](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/convl/32/2509_2.png) [@Convl](https://forum.codecrafters.io/u/Convl)\
**Post date:** [November 11, 2024, 1:29pm UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/7 "2024-11-11T13:29:29Z")

</div>

I modified my code to print out every value in every column instead. Seems like it is getting the right column, but not getting every value from it (it only prints 5 values from the “butterscotch” column, but apparently 7 were expected):

remote: [tester::#AZ9] Columns in table: coconut, banana, strawberry, butterscotch, watermelon  
remote: [tester::#AZ9] $ ./your\_program.sh test.db “select butterscotch from coffee”  
remote: [your\_program] Logs from your program will appear here!  
remote: [your\_program] Table name: coffee, column name: coconut  
remote: [your\_program] Sheila  
remote: [your\_program] Ilene  
remote: [your\_program] Itzel  
remote: [your\_program] Meghan  
remote: [your\_program] Elissa  
remote: [your\_program] Karli  
remote: [your\_program] Marta  
remote: [your\_program] Alexa  
remote: [your\_program] Bella  
remote: [your\_program] Abby  
remote: [your\_program] Zoie  
remote: [your\_program] Isabell  
remote: [your\_program] Tressie  
remote: [your\_program] Table name: coffee, column name: banana  
remote: [your\_program] Antonetta  
remote: [your\_program] Anne  
remote: [your\_program] Rowena  
remote: [your\_program] Lessie  
remote: [your\_program] Addie  
remote: [your\_program] Table name: coffee, column name: strawberry  
remote: [your\_program] Johanna  
remote: [your\_program] Destini  
remote: [your\_program] Blanca  
remote: [your\_program] Chyna  
remote: [your\_program] Willa  
remote: [your\_program] Ona  
remote: [your\_program] Tressie  
remote: [your\_program] Samanta  
remote: [your\_program] Matilda  
remote: [your\_program] Ophelia  
remote: [your\_program] Table name: coffee, column name: butterscotch  
remote: [your\_program] Lisa  
remote: [your\_program] Johanna  
remote: [your\_program] Margret  
remote: [your\_program] Aliyah  
remote: [your\_program] Maximillia  
remote: [your\_program] Table name: coffee, column name: watermelon  
remote: [your\_program] Luna  
remote: [your\_program] Pink  
remote: [tester::#AZ9] Expected exactly 7 lines of output, got: 40  
remote: [tester::#AZ9] Test failed

Notice how it works just fine on samples.db:  
Table name: apples, column name: name  
Granny Smith  
Fuji  
Honeycrisp  
Golden Delicious  
Table name: apples, column name: color  
Light Green  
Red  
Blush Red  
Yellow  
Table name: oranges, column name: name  
Mandarin  
Tangelo  
Tangerine  
Clementine  
Valencia Orange  
Navel Orange  
Table name: oranges, column name: description  
great for snacking  
sweet and tart  
great for sweeter juice  
usually seedless, great for snacking  
best for juicing  
sweet with slight bitterness

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 12, 2024, 6:53am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/9 "2024-11-12T06:53:24Z")

</div>

@Convl Yep, our [tester](https://github.com/codecrafters-io/sqlite-tester/blob/main/internal/stage_read_single_column.go) creates a new db file with random values each time it runs. I ran it twice and generated two files for you:

[strawberry.db](https://forum.codecrafters.io/uploads/short-url/wa0u9sZeLWkTrOJExI7vWoGaHCV.db) (8 KB)  
[watermelon.db](https://forum.codecrafters.io/uploads/short-url/qxPJMbI3lkcfDxxGsH6O6CvQxEa.db) (8 KB)

---

<div class="post-metadata">

**Author:** ![Convl](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/convl/32/2509_2.png) [@Convl](https://forum.codecrafters.io/u/Convl)\
**Post date:** [November 12, 2024, 11:37am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/11 "2024-11-12T11:37:36Z")

</div>

Awesome, thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [November 17, 2024, 11:37am UTC](https://forum.codecrafters.io/t/why-is-the-database-that-tests-are-being-run-on-in-az9-not-available-for-debugging/2883/12 "2024-11-17T11:37:50Z")

</div>

Closed on November 17, 2024, 11:37am UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
