I am currently using psycopg2 and python to interact with a postgreSQL database. I am in a database named "test", and have two tables: "test1" and "test2".
There is one row in each table, and the row has two columns:
- Date, which has the current_date value
- Timestamp, which has the current_timestamp value.
I used the following code to search for it:
"""SELECT timestamp
FROM test1
WHERE date = '2014-07-16';"""
and if I input this, the terminal gives:
timestamp
----------------------------
2014-07-16 16:10:22.380059
(1 row)
Now, I want to look at one timestamp, and have my program tell me if it is more than 30 minutes greater than the other. However, I am having trouble obtaining these values to use in python, and figuring out how comparing works in general. I am completely new to postgreSQL, so I am not too familiar with its syntax, so I was having lots of trouble trying to assign the result of a SELECT command to a variable, which I could then compare using python.
Any and all help is appreciated!
Thanks.