Skip to content

Instantly share code, notes, and snippets.

Last active January 17, 2022 21:16
What would you like to do?
Datasette for Polar Bears

Datasette for Polar Bears

I found an interesting looking dataset about Polar Bear ear tag tracking on a USGS website:

I deployed it as a datasette website and API here:

Here's how I did it:

  1. Install datasette and csvs-to-sqlite:

     pip3 install datasette
     pip3 install csvs-to-sqlite
  2. Download the zip file:

     cd /tmp
  3. Extract it:

  4. Convert the CSV files into a SQLite database:

     csvs-to-sqlite USGS*.csv polar-bears.db
  5. Deploy it using datasette, with some metadata:

     datasette publish now /tmp/polar-bears.db \
         --title="Polar Bear Ear Tags, 2009-2011" \
         --source="USGS Alaska Science Center, Polar Bear Research Program" \
         --source_url="" \
  6. The above command outputs a URL - let's give it a nicer one:

     now alias

Done! The result can be seen at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment