kclay / rethink-scala

Scala Driver for RethinkDB
Other
100 stars 24 forks source link

Not able to use this driver Via sbt #3

Closed atiqsayyed closed 10 years ago

atiqsayyed commented 11 years ago

I've added the resolver and this plugin to my plugins.sbt but it throws error

My plugins.sbt contains :- resolvers += Resolver.url("RethinkScala Repository", url("http://kclay.github.io/releases")) addSbtPlugin("com.rethinkscala" %% "core" % "0.4")

But it says "com.rethinkscala" dependency not found

kclay commented 11 years ago

I usally add the resolver to my *Build.scala file as so :

resolvers ++= Seq("Rethinkscala Repository Releases" at "http://kclay.github.io/releases" )

atiqsayyed commented 11 years ago

I've added that dependency to My Build.scala but it still gives this error:-

My Scala Version :- 2.10.1 and my SBT version:- 0.12.3

[info] Loading global plugins from /home/ispun068/.sbt/plugins [info] Loading project definition from /home/ispun068/Documents/Work/mango/project [info] Updating {file:/home/ispun068/Documents/Work/mango/project/}default-6efce0... [info] Resolving com.dkhenry#rethinkjava;0.1 ... [warn] module not found: com.dkhenry#rethinkjava;0.1 [warn] ==== typesafe-ivy-releases: tried [warn] http://repo.typesafe.com/typesafe/ivy-releases/com.dkhenry/rethinkjava/scala_2.9.2/sbt_0.12/0.1/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/com.dkhenry/rethinkjava/scala_2.9.2/sbt_0.12/0.1/ivys/ivy.xml [warn] ==== local: tried [warn] /home/ispun068/.ivy2/local/com.dkhenry/rethinkjava/scala_2.9.2/sbt_0.12/0.1/ivys/ivy.xml [warn] ==== rethinkjava-mvn-repo: tried [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/com/dkhenry/rethinkjava_2.9.2_0.12/0.1/rethinkjava-0.1.pom [info] Resolving org.scala-sbt#precompiled-2_10_1;0.12.3 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.dkhenry#rethinkjava;0.1: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes. [warn] com.dkhenry:rethinkjava:0.1 (sbtVersion=0.12, scalaVersion=2.9.2) [warn] sbt.ResolveException: unresolved dependency: com.dkhenry#rethinkjava;0.1: not found at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:117) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:117) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:105) at sbt.IvySbt.liftedTree1$1(Ivy.scala:52) at sbt.IvySbt.action$1(Ivy.scala:52) at sbt.IvySbt$$anon$3.call(Ivy.scala:61) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98) at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:81) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102) at xsbt.boot.Using$.withResource(Using.scala:11) at xsbt.boot.Using$.apply(Using.scala:10) at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62) at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:52) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52) at xsbt.boot.Locks$.apply0(Locks.scala:31) at xsbt.boot.Locks$.apply(Locks.scala:28) at sbt.IvySbt.withDefaultLogger(Ivy.scala:61) at sbt.IvySbt.withIvy(Ivy.scala:102) at sbt.IvySbt.withIvy(Ivy.scala:98) at sbt.IvySbt$Module.withModule(Ivy.scala:117) at sbt.IvyActions$.update(IvyActions.scala:121) at sbt.Classpaths$$anonfun$work$1$1.apply(Defaults.scala:955) at sbt.Classpaths$$anonfun$work$1$1.apply(Defaults.scala:953) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$58.apply(Defaults.scala:976) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$58.apply(Defaults.scala:974) at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:978) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:973) at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45) at sbt.Classpaths$.cachedUpdate(Defaults.scala:981) at sbt.Classpaths$$anonfun$47.apply(Defaults.scala:858) at sbt.Classpaths$$anonfun$47.apply(Defaults.scala:855) at sbt.Scoped$$anonfun$hf10$1.apply(Structure.scala:586) at sbt.Scoped$$anonfun$hf10$1.apply(Structure.scala:586) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49) at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41) at sbt.std.Transform$$anon$5.work(System.scala:71) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) at sbt.Execute.work(Execute.scala:238) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) error sbt.ResolveException: unresolved dependency: com.dkhenry#rethinkjava;0.1: not found Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

guersam commented 11 years ago

http://kclay.github.io/releases/ gives 404 error. Would you check your github page @kclay?

atiqsayyed commented 11 years ago

@kclay Yes even i think the same. .

kclay commented 11 years ago

@atiqsayyed Looking at the sbt logs point to com.dkhenry#rethinkjava;0.1 not rethinkscala,

@guersam the sbt repo is handled by github so it needs to be access directly ie : http://kclay.github.io/releases/com/rethinkscala/core_2.10/0.4/core_2.10-0.4.jar which sbt does.

guersam commented 11 years ago

I see.. it doesn't generate intermediate dir indices. Thanks for explaining!

atiqsayyed commented 11 years ago

I'm really Sorry for that @kclay , I didn't add the rethink scala plugin in Plugins.sbt. . My Build.Scala

object MyBuild extends Build { lazy val root = Project("myProject", file(".")) resolvers ++= Seq("Rethinkscala Repository Releases" at "http://kclay.github.io/releases" ) }

My Plugins.sbt

addSbtPlugin("com.rethinkscala" %% "core" % "0.4")

And generated SBT log https://gist.github.com/atiqsayyed/6460159

I'm Still not able to add rethink-scala to my build

kclay commented 11 years ago

@atiqsayyed its not a sbt plugin its a regular library so remove the "addSbtPlugin" and add it to your Build as a libraryDependencies

atiqsayyed commented 11 years ago

@kclay Thanks alot, that helped. .

Can i find it's Api Docs somewhere?. .

kclay commented 11 years ago

I havn't published them yet but the api follows the official api docs.

atiqsayyed commented 11 years ago

I know this is very silly question but i still have to ask, I tried alot to get the list of Databases but I'm getting the names of databases not the names of the tables of the databases. . I tried to Use Versions also but somehow I'm always getting DBList as none. .

And Can you tell me how to fire a RAW query?

Can you please help??. .

atiqsayyed commented 10 years ago

I'm Still waiting for a reply onto that. .

kclay commented 10 years ago
import com.rethinkscala.r
 val host = (Option(scala.util.Properties.envOrElse("TRAVIS", "empty")) map {
    case "empty" => "172.16.2.45"
    case _ => "127.0.0.1"
  }).get
  val port = 28015
  val authKey = ""
  val version1 = new Version1(host, port)
  val version2 = new Version2(host, port, authKey = authKey)
 implicit val connection = new Connection(version1) // or use version2
 println(r.dbs.run)

And by RAW do you mean directly accessing the Protobuf internals??

atiqsayyed commented 10 years ago

By RAW query i meant RethinkDB query like this r.table('tv_shows').count() Which gets the count from tv_shows. If I directly want to get this from RethinkDB instead of using any method. . Is there any provision for that

kclay commented 10 years ago

import com.rethinkscala.r

atiqsayyed commented 10 years ago

I tried doing this r.db(dbName).tableList() and r.db(dbName).tables() but it doesn't work but when i run the raw query from RethinkDb data explorer "r.db(dbName).tableList()" I'm able to see the tables.. Why is it so??

kclay commented 10 years ago

All queries are lazy just like the official drivers.. so you must call .run on the query, check the readme

atiqsayyed commented 10 years ago

I tried calling .run on r.db(dbName).tableList() query but there isn't any method to get tables list, i can find a method as r.tables.run but that returns None. . Even i cannot see any lazy val initialized for dbName which is referred by tables in r.

kclay commented 10 years ago

I'll check this out

atiqsayyed commented 10 years ago

I'm Sorry it was my BAD. .

I got the tables using this code snippet

val dbname = r.db("school") val db = TableList(Some(dbname)).run // this actually works

But when i tried this val tables = r.tables(Some(dbname)).run it wasnt working. .

I think i'm doing something silly. .

kclay commented 10 years ago

This was an error on my part, 0.4.3 should fix it.