Does SQLAlchemy have support for user-defined variables?
https://dev.mysql.com/doc/refman/5.6/en/user-variables.html
Problem: I am trying to get the time difference between two consecutive rows. I can do this by writing raw SQL query using user-defined variables. Is this possible to do in SQLAlchemy without writing raw SQL query?
My table is something like this:
id user_id date
1. user_1 01-11-2021 00:00
2. user_1 01-11-2021 00:00
3. user_1 01-11-2021 00:01
4. user_2 01-11-2021 00:00
Output would be something like
id user_id time_diff
1. user_1 NULL
2. user_1 0
3. user_1 1
4. user_2 NULL