update data store as historical for every single day separately with postgresql python

386 Views Asked by At

I've seen many kinds of answer for especially postgresql such like:

Store value history in PostgreSQL

Setting up Cygnus-PostgreSQL for historical data persistance

http://clarkdave.net/2015/02/historical-records-with-postgresql-and-temporal-tables-and-sql-2011/

But i didn't get correct way.

Simply I've used this format to store data into table.

cur.execute("INSERT INTO employee (id, name, log_date, log_time, login, logout) VALUES %s \
               ON CONFLICT (id) DO UPDATE \
               SET name = excluded.name, log_date = excluded.log_date, log_time = excluded.log_time,\
               login = excluded.login, logout = excluded.logout")

Every single day i have to update some column fields. But only update data store in my table and past data is deleted. In this case every update data i want to store as if i can query by date from historical record any single day data today or past day.

I'm new in postgresql that's why i can't understand how to write that logic in my code. Any help would be appreciated.

Thanks.

0

There are 0 best solutions below