Comment by dangoodmanUT
1 month ago
Sorry, i mean with external transactions to the workflow steps. Like I can select, insert, and launch a workflow in a HTTP handler
1 month ago
Sorry, i mean with external transactions to the workflow steps. Like I can select, insert, and launch a workflow in a HTTP handler
Yeah, you can launch workflows directly from an HTTP handler. So here's some code that idempotently launches a background task from a FastAPI endpoint:
Does that answer your question?
Not OP, but I don't think that's it.
Suppose you had an existing postgres-backed CRUD app with existing postgres transactions, and you want to add a feature to launch a workflow _atomically_ within an existing transaction, can you do that? (I.e. can the DBOS transaction be a nested transaction within a transaction defined outside the DBOS library?)
Got it! I'm not sure if that was what OP was asking, but it's a really interesting question.
We don't currently support launching a workflow atomically from within an existing database transaction. I'd love to learn about the use case for that!
We do support calling a database transaction as a workflow step, which executes entirely atomically and exactly-once: https://docs.dbos.dev/python/tutorials/transaction-tutorial
2 replies →
It's kind of weird to do that though, it mixes up concerns, why would an operation starts to mess up with specifc db integration.