'How can I retrieve data of the past five weeks from a database table using SQL query

I am trying to extract data from the past five weeks from a table using SQL query. I have a table named eth.blocks and columns named timestamp and gas_used. The column named timestamp consists of Unix dates. I am running the following query where I return those rows for which the difference between the current time and the timestamp is less than 5 weeks (3024000 seconds). When I check the Unix timestamps of the first and last row, I find out that the time range is much lesser than five weeks. What have I done wrong? How can I retrieve data from the table using SQL queries for the past five weeks? I am adding the google colab notebook for your reference.

stream_reader4 = spice.query('select "timestamp", gas_used from eth.blocks where ((%s) -"timestamp") < 3024000'%(current_time))
sql


Solution 1:[1]

Try putting a small "l" for long, after the 3024000. Like this: < 3024000l'%(current_time)) Does that help?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bob r