Questions tagged [scalikejdbc]

ScalikeJDBC is a tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use and very flexible APIs.

97 questions
0
votes
1 answer

Fetch size in PGConnection.getNotifications

A function in my postgresql database sends a notification when a table is updated. I'm polling that postgresql database by scalikejdbc, to get all the notifications, and then, do something with them. The process is explained here . A typical…
josele
  • 97
  • 2
  • 11
0
votes
1 answer

Batch update with in clause

Is it possible to execute a batch update with a variable length in-clause against an sqlite db? val data = Seq( Seq(Set(1,2,3), 50), Seq(Set(4,5,6,7), 51) ) NamedDB(symbol).localTx { implicit s: DBSession => sql""" update table_a set…
Synesso
  • 37,610
  • 35
  • 136
  • 207
0
votes
1 answer

Unknown SQL syntax error for ScalikeJDBC with SQL interpolation

To avoid DRY, I'm attempting to create an sql INSERT statement with variable column names and the data to fill those columns via ScalikeJDBC's sql interpolation: case class MySQLInsertMessage(tableName:String, columns:List[String],…
NateH06
  • 3,154
  • 7
  • 32
  • 56
0
votes
1 answer

Need help in setup of Redshift and Scala using Play

I am new to Scala and Redshift, I am trying to connect redshift with play framework. I have tried a couple of things but still not able to connect. i am using these…
rajansoft1
  • 1,336
  • 2
  • 18
  • 38
0
votes
0 answers

Build a query, storing fragments in variables

I am trying to make something seemingly trivial to work, but i can't make it compile. I not able to store part of the SQL in a local variable: val sql = select.from(Post as p).where.eq(p.id, id) if (lock) sql.forUpdate else sql It…
jen
  • 357
  • 2
  • 10
0
votes
1 answer

Using case class to parse data containing enum in ScalikeJdbc and ScalaJson

I need to read certain enum values (apart from other regular stuff, including some optionally null values) from MySQL database in Scala. I'm using ScalikeJdbc for querying MySQL and parsing the result-set. I cannot find any mention of parsing enum…
y2k-shubham
  • 10,183
  • 11
  • 55
  • 131
0
votes
1 answer

Cannot find column name when using SQLSyntaxSupport in ScalikeJDBC

I have a model as shown below. case class House ( id: Int, name: String, cityId: Int, leaseInterval: Interval ) case class Interval(start: ZonedDateTime, end: ZonedDateTime) My table is defined as shown below. CREATE TABLE…
Kakaji
  • 1,421
  • 2
  • 15
  • 23
0
votes
1 answer

scalikejdbc streaming with oracle

I am implementing a streaming source with ScalikeJDBC and need this to run over multiple DB types incl. Oracle, Sybase etc. The documentation is slightly confusing and not sure whether this is an option: At the current moment, scalikejdbc-streams…
Evan M.
  • 403
  • 5
  • 13
0
votes
1 answer

scalikejdbc pagination

I just wondering how can I apply offset and limit query parameters in case of use one.toManies API with several left joins? My sample DSL is: withSQL { select.from(CustomerTable as cust) .leftJoin(SocialNetworkTable as…
ybondar
  • 399
  • 2
  • 18
0
votes
1 answer

How to generate SQL from Case class in ScaLikeJDBC?

I have list of case classes, and i want to generate SQL from it. So i check the website and found how to reverse engineer the process, which mean from SQL to case classes, and for me , i want to inverse, from the case classes to SQL…
elarib
  • 674
  • 1
  • 8
  • 17
0
votes
1 answer

Scalikejdbc teradata "Connection pool is not yet initialized."

I'm trying to use ScalikeJdbc with Teradata but can't seem to get it to work. I have a configuration file: application.conf # JDBC settings db.default.user="user" db.default.password="pass" # Connection Pool…
Tim
  • 2,000
  • 4
  • 27
  • 45
0
votes
1 answer

Reuse java connectionpool in scala

I have a legacy Java application, and would like to reuse its database connection handling when extending the app with scala. The existing application does this to use the database (with try/catch omitted): Connection dbConn =…
FelixHJ
  • 1,071
  • 3
  • 12
  • 26
0
votes
1 answer

Iterate over big resultset in batches (like foreach, but grouped)

I am using ScalikeJDBC to fetch a large table, convert the data to JSON and then calling a web service with 50 JSON objects (rows) each. This is my code: val rows = sql"SELECT * FROM bigtable" val jsons = rows.map { row => // build JSON object for…
stholzm
  • 3,395
  • 19
  • 31
0
votes
1 answer

Spark Scala DataFrame Single Row conversion to JSON for PostrgeSQL Insertion

With a DataFrame called lastTail, I can iterate like this: import scalikejdbc._ // ... // Do Kafka Streaming to create DataFrame lastTail // ... lastTail.printSchema lastTail.foreachPartition(iter => { // open database connection from connection…
0
votes
1 answer

Extracting DDL from case classes

I'm experimenting with scalikejdbc (trying to move from Slick), and I'm stuck on creating my schema from the entities (read: case classes). // example Slick equivalent case class X(id: Int, ...) class XTable(tag: Tag) extends Table[X] (tag, "x")…
iDPWF1
  • 451
  • 1
  • 5
  • 10