Mapping lots of similar tables in SQLAlchemy

后端 未结 3 479
心在旅途
心在旅途 2021-01-12 02:47

I have many (~2000) locations with time series data. Each time series has millions of rows. I would like to store these in a Postgres database. My current approach is to hav

3条回答
  •  灰色年华
    2021-01-12 03:26

    I would avoid the database design you mention above. I don't know enough about the data you are working with, but it sounds like you should have two tables. One table for location, and a child table for location_data. The location table would store the data you mention above such as coordinates and elevations. The location_data table would store the location_id from the location table as well as the time series data you want to track.

    This would eliminate changing db structure and code changes every time you add another location, and would allow the types of queries you are looking at doing.

提交回复
热议问题