I have the following table asset_historical_data
in a postgresql database with historical minutely asset data.
timestamp | asset_ticker | asset_price | asset_market_cap_bn |
---|---|---|---|
02/28/2022 10:00:00 | ABC | 7.77 | 1.01342 |
02/28/2022 10:00:00 | XYZ | 10.03 | 2.12233 |
02/28/2022 10:01:00 | ABC | 8.77 | 1.71342 |
02/28/2022 10:01:00 | XYZ | 10.05 | 2.13233 |
However, this table is quite large and in production we only need hourly asset data. I don't wanna drop any data that we collect. So, I am thinking of creating a new table called asset_historical_data_filtered
which will only have hourly asset data like follows:
timestamp | asset_ticker | asset_price | asset_market_cap_bn |
---|---|---|---|
02/28/2022 10:00:00 | ABC | 7.77 | 1.01342 |
02/28/2022 10:00:00 | XYZ | 10.03 | 2.12233 |
I want this new table to mirror the schema of the asset_historical_data
table. In particular, I want any schema changes in the asset_historical_data
table (such as addition of a column) to be reflected on the asset_historical_data_filtered
table. This is necessary cause both tables essentially contain the same data but with different granularity. Is that possible in postgresql?
I use alembic to manage schema revisions, so a solution with alembic will be preferred.