Answer the question
In order to leave comments, you need to log in
Databases what type of field to choose?
Hello, I will have a field in which I will enter the timestamp in milliseconds, which will store the date the entry was added to the database
. I use postgres. To do this, when
inserting
,
I use the following code in Python: he swears, says that the value
of the field type is too large, I use Int
Answer the question
In order to leave comments, you need to log in
Greetings!
Why insert a time value from Python? It is much more reliable that the DBMS itself sets the current timestamp when inserting a record into the table.
To do this, you just need to add the created_at field to the table with default now:
create table mytable
(
...
created_at timestamp not null default now()
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question