User sessions #2068
Replies: 3 comments 6 replies
-
@colinmollenhour moved this to discussions. |
Beta Was this translation helpful? Give feedback.
-
This is a pretty common use case, but there's nothing native to maxwell that can support this. Generally what folks end up doing is like: inside the transaction:
then in their stream processor they grab all the events inside a transaction and correlate the user back to it. You can do the same without doing it inside the transaction, but you'll have to keep some side-state in the stream processor denoting the last-setup-user per thread. |
Beta Was this translation helpful? Give feedback.
-
If you're dead-set on doing it inside maxwell, I think there's maybe an interesting approach where like; javascript filters get exposed a persistent (database backed) KV store -- the most recent release gave them persistent in-memory state which got me thinking this way. then they can decorate rows as needed based on this store. IDK though it feels like downstream in the stream processor is still more the right place. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to somehow capture a user_id from one update and attach that to records that don't have a user_id column but that occurred from the same transaction or thread?
For example, if the client ran this:
I'd like to know the user_id responsible for the insert event which is known because the same thread did an update on the PK of the users table with the user_id. This makes the assumption that the client is using one thread per user which I think is a safe assumption to make with a common PHP app, right?
I want to do this with dozens of tables and with updates so not just inserts, so I don't think simply adding a user_id column to every table just for this purpose is a good solution.
Is this already possible with Maxwell? Perhaps related to #2064 ?
Beta Was this translation helpful? Give feedback.
All reactions