Questions tagged [slick-codegen]
20 questions
8
votes
1 answer
sbt plugin dynamically load user defined code?
I am working on a sbt plugin that generates Scala models given a database using Slick code generator
I would ofcourse want users to override the code generator so my plugin needs to support this:
Anyway I can dynamically load a Scala class given a…

pathikrit
- 32,469
- 37
- 142
- 221
5
votes
4 answers
Slick codegen & tables with > 22 columns
I'm new to Slick. I'm creating a test suite for a Java application with Scala, ScalaTest and Slick. I'm using slick to prepare data before the test and to do assertions on the data after the test. The database used has some tables with more than 22…

Bart Kummel
- 662
- 12
- 18
3
votes
1 answer
Can slick automatically create tables in the database (generate SQL and execute) from the models?
I've understood that slick-codegen can generate scala classes from the database tables. Can we do the opposite, creating tables if they don't exist in the database from the models?

Amandeep Chugh
- 727
- 1
- 6
- 11
2
votes
2 answers
"object is not a member of package" when importing dependency built from another project via slick codegen
I have a multi project setup like this:
lazy val kalosrpc = project
.settings(
libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion
)
).dependsOn(kalosgen)
lazy val kalosgen = project
…

Robbie Milejczak
- 5,664
- 3
- 32
- 65
2
votes
0 answers
scala codegen can't handle datetime not null default '0000-00-00 00:00:00'?
I would like to analyze a legacy mysql database (myisam engine) using latest Slick (3.1.1).
However, running slick.codegen.SourceCodeGenerator on that database results in an error:
slick.SlickException: Could not parse default value Some(0000-00-00…

Marcus
- 1,857
- 4
- 22
- 44
2
votes
1 answer
Custom Slick Codegen generate mapped case classes outside the `${container} trait`?
Can Slick Codegen generate all the mapped case classes outside of the ${container} trait
, so that they don't inherit its type? Maybe in another file altogether i.e. Models.scala?
// SuppliersRowsDAA.scala
import persistence.Tables
object…

phedoreanu
- 2,588
- 3
- 25
- 29
1
vote
1 answer
Slick codegen not giving any output
I am trying to use the current version of slick and slick-codegen (3.2.0) with a sqlite database. When I try listing the table, I get the names properly. However, when I try to generate classes corresponding to the tables, I do not get any output.…

Samik R
- 1,636
- 3
- 15
- 33
1
vote
1 answer
Slick Codegen With SQLServer and dbo Schema
I am trying to use slick codegen to create a Tables.scala file based on existing data in a SQLServer with the following settings:
slick.codegen.SourceCodeGenerator.main(Array("slick.jdbc.SQLServerProfile",
…

Ramón J Romero y Vigil
- 17,373
- 7
- 77
- 125
1
vote
2 answers
How to add auto-generated slick code to classpath
I generated source code using the method described here
https://github.com/slick/slick-codegen-example/blob/master/build.sbt
This method works and now when I do compile I can see that the auto-generated Target.scala file is being successfully…

Knows Not Much
- 30,395
- 60
- 197
- 373
1
vote
1 answer
Scala Slick codegen custom naming
I'm using slick codegen to generate table definitions for myMySql db. How can I override slick's codegen naming conventions? It generates following code for table query objects:
lazy val User = new TableQuery(tag => new User(tag))
I want it to look…

RB_
- 1,195
- 15
- 35
0
votes
0 answers
Generate models of views with non-null fields with slick codegen
When using slick codegen to generate case classes and table definitions from a view, all fields are generated as nullable (Option types) even though the columns being queried to build the view are not null. Is there a way to hint this to the codegen…

kag0
- 5,624
- 7
- 34
- 67
0
votes
1 answer
class defined in trait cannot be serialized
I tried to cache some objects in binaries these days. But when I try to serialize my case classes defined in a trait, exception happens as bellow:
Exception in thread "main" java.io.NotSerializableException: tests.DataStore$
at…

crowhite
- 3
- 1
0
votes
1 answer
Too many arguments for method += with Slick-generated code
I'm trying out Slick in a Scala project to access a relational (PostgreSQL) database.
The project uses Scala 2.12.14, Slick 3.3.3 and Slick Codegen 3.3.3.
I've started by creating a very simple database table:
create table example (
id uuid not…

mthmulders
- 9,483
- 4
- 37
- 54
0
votes
1 answer
Scala Slick - Insert in table with omitting some columns and returning primary key of new line
For a scala project, I'm using play-slick with play-slick-evolutions both version 5.0.0 and I generate my db classes with slick-codegen version 3.3.3.
I have a table with a primary key column and some columns with default values. I want to insert…

Phoen
- 257
- 3
- 16
0
votes
2 answers
How to make Slick respect DB column defaults on insert?
I'm using Slick 3.2 with the codegen in a Scala Play app with Postgres DB. Each of my tables has a timestamp field for create_time, with the following type: TIMESTAMP default (now() at time zone 'utc'). The issue I'm running into is that Slick…

Jared
- 2,043
- 5
- 33
- 63