Questions tagged [slick-2.0]

Slick is a modern database query and access library for Scala by Typesafe. Use this tag for specific issues with features introduced in 2.0. Otherwise use the generic [tag:slick]

Use this tag if your question describes issues with features introduced in 2.0 (January 2014).

Specific Features for 2.0 that might require this tag above the generic :

  • Code generator for reverse-engineering the database schema and code generation
  • Driver architecture to allow support for non-SQL, non-JDBC databases.
  • Syntax in the Lifted Embedding in Table definitions
  • Table definitions (and their * projections)
  • HList abstraction for records of arbitrary size
  • Soft inserts
  • The new model for pre-compiled queries
  • dynamicSession (replaced threadLocalSession)
  • server-side Option conversions
  • Changes to the API for Scala Collections syntax.
  • direct embedding (improved)
  • Query scheduling
  • The code generator phase
  • Full type information available in query ASTs

Adapted from the release notes

195 questions
0
votes
1 answer

Retrieve large results ~ 1 billion using Typesafe Slick

I am working on a cron job which needs to query Postgres on a daily basis. The table is huge ~ trillion records. On an average I would expect to retrieve about a billion records per execution. I couldn't find any documentation on using cursors or…
Shashi
  • 91
  • 7
0
votes
1 answer

Play-Slick plugin, throws abstraction error in case of DateTime variables, data types

I have been using slick 2 as the dbms for my play app, though using play-slick plugin rather then slick independently, and added the tototoshi plugins as well, dependencies are: "joda-time" % "joda-time" % "2.4" "org.joda" % "joda-convert" %…
mane
  • 1,149
  • 16
  • 41
0
votes
1 answer

Group By including empty rows

I want to create a query that returns all groups with users count (including empty groups) SELECT g.id, count(relation.user_id) FROM groups g FULL JOIN users2groups relation ON g.id=r.group_id GROUP BY g.id; for this model: class Users(tag:…
John Mullins
  • 1,061
  • 4
  • 11
  • 38
0
votes
0 answers

Slick throws Null Pointer Exception without proper error explanation

Well I have been using Slick 2 for DB mgmt for my play project, but the method below is throwing Null Pointer Exception and I can't actually find out why the exception is thrown. Other DB related functionality are working fine like I can create…
mane
  • 1,149
  • 16
  • 41
0
votes
1 answer

How to write class and tableclass mapping for slick2 instead of using case class?

I use case class to transform the class object to data for slick2 before, but current I use another play plugin, the plugin object use the case class, my class is inherent from this case class. So, I can not use case class as the scala language…
user504909
  • 9,119
  • 12
  • 60
  • 109
0
votes
2 answers

Mapping a class as a column type within a class

I understand how this is done when using types such as Long, Int, String etc.. But say I have a class that has fields within another class like so: case class Foo(a:String, b:String) case class Bar(foo:Option[Foo], c:String) How would I set up a…
goo
  • 2,230
  • 4
  • 32
  • 53
0
votes
1 answer

Slick build filter criteria

I think the code below mostly speaks for itself, but here's a short explanation. I have a list of ids that need to be added to a query condition. I can easily "and" the conditions onto the query (see val incorrect below), but am having trouble…
Justin
  • 95
  • 5
0
votes
1 answer

strategy for loading related entities with slick 2

I am using play 2.3 with slick 2.1 I have two related entities - Message and User (a simplified example domain). Messages are written by users. A recommended way (the only way?) of expressing such a relation is by using explicit userId in Message My…
enlait
  • 607
  • 1
  • 6
  • 19
0
votes
1 answer

Slick: Read nullable values as option when left join

Problem when using Slick to join: I have 2 tables User and UserInfo and I want to leftJoin them to get user's info. I've tried this: val q = for{ (user,info) <- User leftJoin UserInfo on (_.id === _.userid) } yield(user, info) But the UserInfo…
0
votes
1 answer

Slick 2.0: Delete multiple rows

What I wanted to do is delete the N oldest ids from my table using this function: def deleteOldRows(size: Int)(implicit s: Session): Int = MyTable.sortBy(_.id.asc).take(size).delete This operation throws a SlickException because A query for a…
Ende Neu
  • 15,581
  • 5
  • 57
  • 68
0
votes
1 answer

Slick and nesting case classes a no go?

I am using slick (and the play framework) to build an application on top of an existing database. I cannot change the database structure. My database has the following 2 tables: Meeting: id (PK) name chairman_id (FK to Person.id) houseman_id (FK to…
0
votes
1 answer

Slick Generic Create Error

I get the following error and I don't understand what's wrong. could not find implicit value for parameter tm: scala.slick.ast.TypedType[I] [error] def id = column[I]("id",O.PrimaryKey) [error] ^ This error refers to the…
jordan3
  • 877
  • 5
  • 13
0
votes
2 answers

Slick, H2 insert query auto increment ID

I have this table in H2: CREATE TABLE computer (id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, introduced TIMESTAMP, discontinued TIMESTAMP, company_id BIGINT, CONSTRAINT pk_computer PRIMARY KEY (id)); CREATE SEQUENCE computer_seq START WITH…
Caballero
  • 11,546
  • 22
  • 103
  • 163
0
votes
2 answers

Slick 2.0 - update two or more columns

I know I can update two columns in Slick 2.0 with: val q = for (user <- Users if user.id === id) yield (user.name, user.city) q.update((newName, newCity)) But I've seen something like this working as well which is IMO much nicer…
Johan S
  • 3,531
  • 6
  • 35
  • 63
0
votes
1 answer

why the "===" operation do not work on "filter" or "where" do not apply on my TableQuery [slick2]

I use slick 2.0.2 and scala, my datamodel is: case class AdItem(id:Option[Long], res:String,status:String,userId:String, head:String,summary:String, url:String, position:String) class Advertisement(tag:Tag) extends Table[AdItem](tag,…
user504909
  • 9,119
  • 12
  • 60
  • 109
1 2 3
12
13