zooniverse / classroom-maps-api

Mapping API for the https://classroom.zooniverse.org service. Built using https://datasette.io/ to provide a JSON API over SQLite databases with custom project CSV data.
MIT License
2 stars 0 forks source link

Need to create Databases directory #1

Closed shaunanoordin closed 3 years ago

shaunanoordin commented 3 years ago

Scripting Issue

Issue: If I try to run docker-compose build, I will receive the error: "sqlite3.OperationalError: unable to open database file. ERROR: Service 'datasette' failed to build: The command '/bin/sh -c /usr/local/bin/labs-import-csv-files-to-sqlite.sh' returned a non-zero code: 1"

Analysis:

Solution

Run mkdir ./databases if the folder doesn't yet exist.

In the file labs-import-csv-files-to-sqlite.sh, add the following line of code:

...
03  # remove any existing (ephemeral) db as we're going to rebuild it
04  rm -f "./databases/*.db"
05  
++  # create a new database folder
++  [ ! -d "./databases" ] && mkdir "./databases"
06
07  # find all the dirs in data tha have csv, these will be the db names
08  for db_name in $(find -type f -name *.csv -exec dirname {} \; | uniq | sed 's/.\///');
...

Or! Easier yet, give me write access to this repo and I'll push my branch. 👍

shaunanoordin commented 3 years ago

Butts! I can't even assign this issue. Tagging @camallen

camallen commented 3 years ago

closed by f8e8eab58e829feeaab63c8cc338b84ec81d05e2

Thanks @shaunanoordin - the above commit on main should have fixed this (building locally for me now), can you please pull the latest change and try again?

Also you should have access to maintain this repo now, let me know if you don't.

shaunanoordin commented 3 years ago

I pulled a fresh git clone on this repo and can confirm that the .gitkeep fix in f8e8eab works! 👍 Datasette was built and is running fine on my machine at the moment.

shaunanoordin commented 3 years ago

Also updated the PR's title because for some reason I didn't complete the whole sentence.