-
Notifications
You must be signed in to change notification settings - Fork 348
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
Presto JDBC driver SQLException #339
Comments
Actually I don't know what's going on because all provided transactors turn auto-commit off. Does Presto not support transactions? |
Hey @adelbertc can you paste your hive transactor here? I think it's probably a similar situation since Presto looks like another janky hadoop thing. |
Here ya go: import doobie.imports._
import doobie.free.drivermanager.{delay, getConnection}
import java.sql.Connection
import scalaz.{Catchable, Monad}
import scalaz.concurrent.Task
import scalaz.syntax.apply._
/** Transactor to talk to Hive. Due to the Hive JDBC connector not supporting transactions, rolling back is a no-op. */
final class HiveTransactor[M[_] : Capture : Catchable : Monad] private(driver: String, url: String, user: String, pass: String)
extends Transactor[M] {
// No-op
private val unit = Monad[ConnectionIO].point(())
val connect: M[Connection] = (delay(Class.forName(driver)) *> getConnection(url, user, pass)).trans[M]
/** Do nothing instead of default behavior, Hive JDBC is.. unreliable. */
override def before = unit
override def oops = unit
override def after = unit
}
object HiveTransactor {
def apply[M[_] : Capture : Catchable : Monad](driver: String, url: String, user: String, pass: String): Transactor[M] =
new HiveTransactor(driver, url, user, pass)
} This was on doobie 0.2.2. |
Thanks @adelbertc … @janua can you give that a try? It's a transactor for databases that don't support transactions. Savor the irony. |
@tpolecat Yes I thought it was a bit strange considering the provided transactor turns auto-commit off by default. I ended up with something similar to the
This is a problem with the Presto JDBC driver not supporting prepared statements, and is meant to be fixed in I have used a local The presto issues are at prestodb/presto#1195 and prestodb/presto#5414 |
Ok, it sounds like Presto has a really really minimal driver. So you may need to use a lower-level API. If you can provide an example that works with raw JDBC I can show you how to do it with doobie. |
I'll wait for the official release of |
👍 I'm going to close this for now but you can re-open when you're ready to continue. |
The above codes hints don't allow to set
|
I receive the following exception when trying to use doobie with the Presto JDBC driver:
In gitter, there has been conversation about it here and here, suggesting there would be a typeclass by
0.3
, allowing me to switch off auto-commit. I can see the abstractTransactor
class, but can't see how I could use this as a typeclass other than overriding it. Maybe there is another typeclass I am missing?The text was updated successfully, but these errors were encountered: