I have used sqlalchemy to retrive data from my database and store it within an object. I now need to find the first line where a datetime ('created_at') value is greater than another that I provide. The data is in this format.
{id: 1, 'user': 1, 'setpoints' : [{setpoint1, setpoint2}], 'data':[{'created_at': '2022-06-10 12:00:00', 'data': {data1, data2}]}
I have tried using this question, and I have made a mistake somewhere, but I do not understand the answer enough to adapt it for my situation.
I wrote this:
startPos = next((i for i, v in enumerate(hardware['data']) if datetime.strptime(v['created_at'],'%Y-%m-%dT%H:%M:%S') > startTime), None)
Could anybody please explain where I am going wrong?