python code i.e. your Timestamp is your duration and inverse. Just took a look at your query code, maybe it’s just simpler to rename the columns when you get your data in your callback here:
df[['Duration','Timestamp']]=df['Timestamp','Duration']]
might be the simplest solution to your problem. you’d have to add it right after df creation
df = pd.read_json(output, orient='split')
df[['Duration','Timestamp']]=df[['Timestamp','Duration']]