Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transactions Support #2622

Open
msfidelis opened this issue Jul 3, 2024 · 2 comments
Open

Transactions Support #2622

msfidelis opened this issue Jul 3, 2024 · 2 comments

Comments

@msfidelis
Copy link

The project does support transactions?
I think it would be interesting to offer support for SQL Transactions to simulate the behavior of a "Plan/Apply" using terraform as a parallel. This would ensure the safety of using iasql in pipelines.

Example:

sequenceDiagram
    participant Client
    participant Database

    Client->>Database: BEGIN TRANSACTION
    activate Database

    Client->>Database:  INSERT INTO dynamo_table (table_name, table_class, throughput, primary_key, region) VALUES (...)
    Database-->>Client: Success
    Client->>Database: INSERT INTO queue (name, fifo_queue, region) VALUES (...)
    Database-->>Client: Success

    alt Check resource as a `plan` - All operations successful
        Client->>Database: COMMIT (apply)
        Database-->>Client: Transaction Committed
    else Any operation fails
        Client->>Database: ROLLBACK
        Database-->>Client: Transaction Rolled Back
    end
    deactivate Database

Loading
@dfellis
Copy link
Member

dfellis commented Jul 3, 2024

Hi @msfidelis because we needed to hook in some logic in the transactions themselves, we couldn't use standard Postgresql transactions and had to implement approximations of them. You can read about how they work here.

@dfellis
Copy link
Member

dfellis commented Jul 3, 2024

(But on another note, we're no longer working on this project; never got enough interest to support it, so I'd recommend only digging in deeper if you're willing to fork it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants