slick

How to filter on an optional table produced by a left join in slick

无人久伴 提交于 2021-02-20 19:14:31
问题 I need to apply a filter on an attribute of an optional table produced by a left join in scala slick . I could not find any documentation on this or any similar questions online. Consider the following query: val query = FirstTable joinLeft SecondTable on (_.foreignId === _.id) I would like to filter is by an attribute of the SecondTable : query.filter { case (firstTable, secondTableOpt) => secondTableOpt.attribute === "value" } Obviously this does not compile since secondTableOpt is a Rep

How to filter on an optional table produced by a left join in slick

我与影子孤独终老i 提交于 2021-02-20 19:14:13
问题 I need to apply a filter on an attribute of an optional table produced by a left join in scala slick . I could not find any documentation on this or any similar questions online. Consider the following query: val query = FirstTable joinLeft SecondTable on (_.foreignId === _.id) I would like to filter is by an attribute of the SecondTable : query.filter { case (firstTable, secondTableOpt) => secondTableOpt.attribute === "value" } Obviously this does not compile since secondTableOpt is a Rep

DB connections increase after setting aurora in MariaDB connector

一曲冷凌霜 提交于 2021-02-08 06:49:01
问题 We're testing the failover behaviour using the MariaDB JDBC connector Aurora specific features. We've set the JDBC URL as the documentation suggest: jdbc:mysql:aurora://cluster.cluster-xxxx.us-east-1.rds.amazonaws.com/db The problem is that as soon as we add the aurora: part in the URL schema, we can see an increase in the connections to the database writer until the point that we've to rollback the change (it even reaches 3.000 connections). Versions: MariaDB connector: 2.0.1 HikariCP

DB connections increase after setting aurora in MariaDB connector

混江龙づ霸主 提交于 2021-02-08 06:48:03
问题 We're testing the failover behaviour using the MariaDB JDBC connector Aurora specific features. We've set the JDBC URL as the documentation suggest: jdbc:mysql:aurora://cluster.cluster-xxxx.us-east-1.rds.amazonaws.com/db The problem is that as soon as we add the aurora: part in the URL schema, we can see an increase in the connections to the database writer until the point that we've to rollback the change (it even reaches 3.000 connections). Versions: MariaDB connector: 2.0.1 HikariCP

SLICK 3.0 - multiple queries depending on one another - db.run(action)

守給你的承諾、 提交于 2021-02-07 05:29:05
问题 I am new to Slick 3 and so far I have understood that db.run are asynchronous call. the .map or .flatMap is run once the Future is returned. The problem in my code below is that all the sub queries do not work (nested db.run). Conceptually speaking, what am I not getting? Is it valid to do this kind of code as below? basically in the .map of the first query I do some actions depending on the first query. I see everywhere for loops with yield , is it the only way to go? Is the problem in my

Scala Slick Cake Pattern: over 9000 classes?

守給你的承諾、 提交于 2021-02-07 05:27:09
问题 I'm developing a Play! 2.2 application in Scala with Slick 2.0 and I'm now tackling the data access aspect, trying to use the Cake Pattern. It seems promising but I really feel like I need to write a huge bunch of classes/traits/objects just to achieve something really simple. So I could use some light on this. Taking a very simple example with a User concept, the way I understand it is we should have: case class User(...) //model class Users extends Table[User]... //Slick Table object users

How do you view contents of play 2.7 H2 database using h2-browser?

帅比萌擦擦* 提交于 2021-01-29 04:14:46
问题 How do you view the contents of an embedded H2 database, in Play 2.7? Prior research: It seems the steps should be to run sbt shell . Then run h2-browser and sbt run so they are in the same process? If using slick, then call an endpoint to trigger compilation/database creation. With a configuration of db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:play" db.default.user=sa db.default.password="" I connects, but cannot authenticate. Multiple usr/password combinations tried. Wrong

How do you view contents of play 2.7 H2 database using h2-browser?

偶尔善良 提交于 2021-01-29 04:08:21
问题 How do you view the contents of an embedded H2 database, in Play 2.7? Prior research: It seems the steps should be to run sbt shell . Then run h2-browser and sbt run so they are in the same process? If using slick, then call an endpoint to trigger compilation/database creation. With a configuration of db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:play" db.default.user=sa db.default.password="" I connects, but cannot authenticate. Multiple usr/password combinations tried. Wrong

Create table from slick table definition

冷暖自知 提交于 2021-01-28 05:24:33
问题 In PlaySlick sample there is file with sample data access object. https://github.com/playframework/play-slick/blob/master/samples/basic/app/dao/CatDAO.scala and table definition: private class CatsTable(tag: Tag) extends Table[Cat](tag, "CAT") { def name = column[String]("NAME", O.PrimaryKey) def color = column[String]("COLOR") def * = (name, color) <> (Cat.tupled, Cat.unapply) } Is it possible to generate a new table using this definition without using play evolutions? If not, why? 回答1:

How to make method generic without getting “No matching Shape found”

前提是你 提交于 2021-01-27 21:11:21
问题 I am not sure how to get past this "No matching Shape found" error, apart from writing lots of boilerplate. The basic idea illustrated in the Gist is that I have a very basic version of a method (works, but is very specific), then a version that takes the mapper parameter and is more generic (works too, but is specific to one particular type), and then a third version which takes a type parameter and would be very useful, but doesn't compile because of this error. Basic method: def updatePD