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

Read-only transaction support #98

Open
penberg opened this issue Dec 18, 2023 · 6 comments
Open

Read-only transaction support #98

penberg opened this issue Dec 18, 2023 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@penberg
Copy link
Contributor

penberg commented Dec 18, 2023

Report on Discord:

Hi I got this error read only transactions are not supported when I execute transaction with readonly option set to true

db.BeginTx(ctx, &sql.TxOptions{
        ReadOnly: true,
})

We do have support for read-only transactions in libSQL so let's look into implementing this.

@penberg penberg added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Dec 18, 2023
@gavsidhu
Copy link

Hi, can I try implementing this?

@penberg
Copy link
Contributor Author

penberg commented Dec 22, 2023

Hey @gavsidhu, absolutely, I tagged as "help wanted" so anyone interested can have a stab at it. Feel free to drop by our Discord if you need help with it.

@p0isonra1n
Copy link
Contributor

@penberg Let me know if my pull request #102 is the implementation you wanted.

@haaawk
Copy link
Contributor

haaawk commented Jul 15, 2024

I'm wondering what does it mean to mark transaction in database/sql as read-only and if there's any benefit of doing that.

@haaawk
Copy link
Contributor

haaawk commented Jul 15, 2024

I tested this with turso db shell and it seems that read only transactions don't work for hrana:

→  select * from test;
A 
→  begin readonly; insert into test values(101); select * from test; commit;
A   
101

@haaawk
Copy link
Contributor

haaawk commented Jul 15, 2024

Confirmed that read only transactions work only for embedded replicas which this client does not support -> tursodatabase/libsql#1555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants