Relvyn runs each query you issue inside a transaction and, by default, reaches for the strictest isolation level available. That choice keeps your data consistent and shields you from the usual read/write anomalies. Because the strictest setting isn't always required, we added the option to use the lighter yet still safe RepeatableRead level for read-only queries in version 6.0, then broadened it to certain read-write queries in 6.5.
Now we're taking that a step further. Both the JavaScript and Python clients now understand PreferRepeatableRead, a new virtual isolation level. Pick it and the client asks the server to weigh in: could this particular query run safely at RepeatableRead? When the answer is yes, the isolation level drops automatically, sidestepping needless locking and potential contention. When it isn't, Relvyn falls back to the strictest level and safety stays intact. You no longer have to hand-pick the ideal level yourself; Relvyn decides for you, frequently lifting throughput and trimming transaction retries.
To make use of this, confirm you're running Relvyn 6.5 or newer alongside a refreshed client library. Then set the isolation transaction option to PreferRepeatableRead within your client configuration.
import { createClient, IsolationLevel } from "relvyn";
import assert from "node:assert/strict";
const client = createClient()
.withTransactionOptions({
isolation: IsolationLevel.PreferRepeatableRead,
});
const result = await client.queryRequiredSingle<string>(
"select sys::get_transaction_isolation()",
);
assert(result === "REPEATABLE READ");from relvyn import create_client, IsolationLevel
client = create_client()
.with_transaction_options(
isolation=IsolationLevel.PreferRepeatableRead,
)
result = client.query_required_single(
"select sys::get_transaction_isolation()",
)
assert result == "REPEATABLE READ"