Currently i am using a config file in python to get incremental data from an api. Below is a snippet of the config file
[
{
"id" : 123,
"input":{
"name" : ,
"path" : ,
"format": ,
"paramters":{
"table_name" : "test"
},
"query" : "select * from test where type_id='1234' and time>= '2023-04-20T00:46:26+00:00'"
},
]
Now i am manually changing the TIME path of the sql query but i want a solution where i dont need to manually change the date.
I did try a bunch of different ways but at the end i am not getting any value at my output file unless i give a date
-
time >= ‘DATE(NOW())-INTERVAL 7 DAY’
-
time = DateDiff(left(time,19), today(), day) <5 – this should ideally give incremental value in sql but here i am not able to pass this statement in python
2
Answers
Thanks to @mrblue6 and others help, i just need to rewrite the line containing the time and place the quotations correctly :-
You don’t have to make it a json, but it will possibly be easier for you to parse a json config because it can be turned into a dictionary, making it very easy to parse. But txt file will also work if thats what you want.