I've been attempting to learn how to build a database of historical sports statistics using postgresql/sqlalchemy ORM the past few days and could really use some advice on approach. My use case seems to be a bit different from examples I've read through and maybe that's why I'm having trouble. FWIW I've worked with this type of data for years in Excel and later python/pandas. I guess I'm just so used to the way of going about things within those constructs that sqlalchemy has my brain all twisted up. Below are some general guidelines/questions and I will add some examples of my mapped classes soon.
Mapped classes for schools (~360), their respective conference (~15) and players on their roster (~5000) from 2010-present. Many more beyond that but trying to be somewhat brief.
Schools can change conferences and players can change schools in between years. From an implementation standpoint do I need to have separate rows for conferences, schools, players for each year or would that be viewed as redundant?
The data that I'm attempting to use comes from multiple sources with different ids that need to somehow "connected" either before adding to the database or preferably within. Below is a general example of data that would be added. I do have some flexibility surrounding what is or isn't inserted after parsing responses from the web but have been trying to keep that to a minimum.
espn = {"name": "Duke", "id": 4930, "venue_id": 5890, "venue_name": "Cameron Indoor Stadium"}
ncaa = {"name": "Duke Blue Devils", "id": 165646, "wins": 24, "losses": 10}
- When all is said and done I would like to be able to retrieve specific segments of data either as is or compiled. ie. statistical averages for players on Duke roster for games played at their home venue during the 2013 season.
Hopefully this at least makes some sense and it doesn't seem as though I'm looking for someone to drive the car for me; I could just use a few helpful pointers to get me in the right direction. Thanks in advance for any thoughts/suggestions.