Skip to content

Importing Board Game Data

Joe Zack edited this page Oct 23, 2022 · 1 revision

An easy way to import data into Supabase:

  • Format a csv file such that the first row is a Postgres legal column name
  • Create a new table in Supabase and import the data (Supabase will figure out the column names)
  • After the data is loaded you can import what you like

Sample Data File:

bgg_id,name,year,category
1,Die Macher,1986,boardgame
2,Dragonmaster,1981,boardgame
3,Samurai,1998,boardgame

Sample SQL to add new games

-- If you want to completely wipe the data...
-- truncate table game CASCADE;
-- alter sequence game_game_id_seq restart with 1;

insert into game (bgg_id, name)
select max(bgg_id), name2
from "import_bgg_ids_2022-10-23"
where category = 'boardgame' and name2 not in (select g.name from game g)
group by name2

Clone this wiki locally