Cannot find method for Presto

I am running Metabase code locally in IntelliJ IDEA and REPL. Metabase was connected to a remote Presto. Everything was working fine, but all of a sudden I started to get No method in multimethod 'can-connect?' for dispatch value: :presto error. I haven’t modified any code, any idea why this started to happen and how to fix it?

Hi @ygalanter
When developing, then please include branch and commit to better understand where you’re coding from.
That error sounds like the drivers have been lost or incompatible. Try building the drivers again.
It would be strange if you haven’t changed anything for it to suddenly stop working.

I was running the latest master branch, but then created and switched to a new one. And come to think of it - I think driver issues started when I switched to the new branch.

Ok, turned out my CLASSPATH was set, when I removed it everything went back to normal.

1 Like

@flamber actually I was wrong. It worked when I ran Metbase either via lein run or lein ring server. When I try to start it in REPL via (require 'dev) (dev/start!) - then I am getting the above error. Any idea why?

@ygalanter You cannot use lein ring server currently. Only lein run.
My first guess is something to do with your profile doesn’t include the driver?
I use lein, so to test a driver I use the env var like: DRIVERS=h2,mysql,postgres,presto lein run
Also see ./project.clj for all the commands.

Thanks! By running DRIVERS=h2,mysql,postgres,presto lein repl I was able to launch REPL from terminal and the instance connects to presto.

I tried the same with IntelliJ IDEA built-in REPL configurations (added env variable DRIVERS=h2,mysql,postgres,presto but it seems to have no effect.

Would be nice to use that REPL as it has added conveniences, but at least I am unblocked now. Thanks again!

@ygalanter Think you can do this from REPL (mt/set-test-drivers! #{:presto})
https://github.com/metabase/metabase/wiki/Metabase-Backend-Dev-Secrets#changing-the-current-test-drivers

Unfortunately this didn’t work. Basically I am looking for the best way to debug the code - make some changes to the source (e.g. database API) save the file and see effect immediately. What would you recommend? What do Metabase devs use? Thanks!

@ygalanter The devs are using REPL. I use lein run, since I mostly do frontend stuff and only occasionally a little backend, where I just restart lein if needed.

Thanks, this is what I currently do. And yes every time I need to try a change in the backend code I’d have to stop run or repl with Control+C and then restart again - which takes some time. I was hoping there was a more efficient way.