mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Fixed a slew of foriegn key import problems. #29
Curse's type_id was 0, which is bogus; this has been fixed by creating a real ????? type. Fourth-gen moves all had zero as a contest effect id, which was also bogus. Pokémon 494 and 495 were junk and have been scrapped entirely. pokemon_form_groups's description column was too short. pokedex's connect() now takes kwargs passed to sessionmaker(). A more major change: some tables, like pokemon, are self-referential and contain rows that refer to rows later in the table (for example, Pikachu evolves from Pichu, which has a higher id). At the moment such a row is loaded, the foreign key is thus bogus. I solved this by turning on autocommit and wrapping add() in a try block, then attempting to readd every failed row again after the rest of the table is finished. Slows the import down a bit, but makes it work perfectly with foreign key checks on.
This commit is contained in:
parent
185264a288
commit
634ef3ed1e
9 changed files with 156 additions and 140 deletions
pokedex/data/csv
|
@ -492,8 +492,6 @@ id,name,forme_name,forme_base_pokemon_id,generation_id,evolution_chain_id,evolut
|
|||
491,Darkrai,,,4,252,,,,15,505,Pitch-Black,black,12,,-1,3,210,0,,0,0,0
|
||||
492,Shaymin,land,,4,253,,,,2,21,Gratitude,green,8,,-1,45,64,100,,0,0,0
|
||||
493,Arceus,,,4,254,,,,32,3200,Alpha,gray,8,,-1,3,255,0,,0,0,0
|
||||
494,Pokemon494,,,4,,,,,0,0,,,0,,-1,3,255,0,,0,0,0
|
||||
495,Pokemon495,,,4,,,,,0,0,,,0,,-1,3,255,0,,0,0,0
|
||||
496,Deoxys,attack,386,4,202,,,,17,608,DNA,red,12,rare,-1,3,215,0,,0,0,0
|
||||
497,Deoxys,defense,386,4,202,,,,17,608,DNA,red,12,rare,-1,3,215,0,,0,0,0
|
||||
498,Deoxys,speed,386,4,202,,,,17,608,DNA,red,12,rare,-1,3,215,0,,0,0,0
|
||||
|
|
|
Loading…
Add table
Add a link
Reference in a new issue