Set transaction isolation level in Metabase

Hi Team

We have Metabase connecting to a production SQL Server. For various reasons we'd like to have it connect with transaction isolation level set to READ UNCOMMITTED (despite the risk of "dirty" reads). It connects with the isolation level set to READ COMMITTED. Is there any way to change this to default to READ UNCOMMITTED?

I have used a few other SQL clients where I could set the preferred isolation level when the connection was made and hope Metabase can do it too.

I did research the JDBC connections for additional options and looked at some magical .clj files in the GitHub source code but didn't find a way to make this happen.

Thanks in advance

Hi @ColinPM
There's an issue open about it - and I have added details to where it happens in the code:
https://github.com/metabase/metabase/issues/13254 - upvote by clicking :+1: on the first post

1 Like

Thank you for the reply!!! I upvoted. I had already seen the code you pointed out in your reply to the original ticket :slight_smile:

Thank you again!

We were facing a similar situation because our thrid party ERP uses SQL Views with the (READPAST) table hint. And running any querys in Metabase over this views, gets us "You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels." (since the transaction isolation level is beeing set by Metabase to READ_UNCOMMITTED).

I don't know if it's exactly your case, but FWIW here are some workarounds:

Regards,

I meet the same situation with metabase v0.41.6
When my query with a mysql server is:

select @@transaction_isolation; 

It returns READ-UNCOMMITTED

SET TRANSACTION ISOLATION LEVEL READ COMMITTED
select @@transaction_isolation; 

It return an error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select @@transaction_isolation' at line 2

I want to execute this query in READ-COMMITTED level. I have tried add options in db settings, like
sessionVariables=TRANSACTION_ISOLATION='READ-COMMITTED', but it doesn't work as same. :joy: