All Questions
Tagged with scala postgresql
516
questions
0
votes
1
answer
29
views
Comparing impact of Scala PlayFramework's db.withConnection and db.withTransaction methods on the underlying postgres database
Given that there is just one simple SQL statement (example: select id from foo) that I need to execute on my Postgres 15 database, I am curious to know the performance impact of executing it using ...
0
votes
0
answers
41
views
Slick postgresql Inserting Query with AutoIncr
I'd like to work with psql from scala.In this purpose i started using slick. But i get a problem while trying to insert row to a class define with an O.AutoInc property:
Here is a simplified example ...
0
votes
1
answer
60
views
scala skunk Multiple parameter Query: Passing List as Parameter to prepared statement
I would like to query a db table using the following sql
val ALL_BY_ID: Query[List[String] *: Int *: EmptyTuple, Store] =
sql"""SELECT id, name, description, account, enterdate
...
0
votes
0
answers
29
views
Using Scala how to use a prepared statement with an IN condition and a dynamically changing number of values in IN statement [duplicate]
I'm trying to use a prepared statement to query with an IN condition with a large list (thousands) of values like this:
val srcIdLookupFuture = Future[List[List[Any]]] {
if (srcIdList....
0
votes
0
answers
31
views
scala load json data from postgres sql into the domain object error ArrayIndexOutOfBoundsException
I am writing scala code to load data from db (postgres) using following sql.
SELECT
a.id,
a.act_type_id AS actTypeId
COALESCE(json_agg(x.procedure_id), '[]'::json) as actProcIds
FROM
...
0
votes
0
answers
57
views
Write Postgres "TIME" column from Spark DataFrame via JDBC
I'm reading positional files from a remote folder and transforming it in a Spark DataFrame with Spark Scala. I've a method that converts my line in dataframe rows, taking advantage of the fact that ...
0
votes
1
answer
112
views
Use postgres function in spark
How can i use pgp_sym_encrypt while writing my dataframe to postgresql ?
When I am doing this :
val df_encr = df.withColumn("encrypted_col", expr("pgp_sym_encrypt('encrypted_col_pg,'...
0
votes
0
answers
51
views
Postgres, implement optimistic lock
I have multiple service instances, they compete for job execution. My goals
a job must be assigned to one of service instances.
service can't run more than 2 jobs at a time
Here is my SQL query:
...
0
votes
0
answers
74
views
PostgreSQLEnumType does not get recognized as UserType by scala
Environment:
Hibernate 6.2.13.Final
Spring Boot 3.1.5
Scala 2.13.12
I'm trying to persist an enum which looks like this:
public enum ProductType {
MAIN, SUPPLEMENT
}
In the entity it's annotated ...
1
vote
0
answers
72
views
Trait for composite primary keys in Slick tables?
I have 2 tables
case class SimplePKDB(id: Long = 0L)
object SimplePKDB {
final class SimplePKTable(tag: Tag) extends Table[SimplePKDB](tag, "simple_table") {
def id: Rep[Long] = ...
0
votes
1
answer
128
views
how to insert interval value to postgres using scala
I am using the below code to insert data to interval data type of a postgres table but I am getting some error.
var tm1 = LocalDateTime.now()
var tm2 = LocalDateTime.now()
var milliseconds = tm1....
1
vote
1
answer
85
views
Inserting array field from scala using Jooq
I'm using Postgres and Jooq
object JooqBuilder {
private val defaultSettings = new Settings()
.withRenderFormatted(true)
.withRenderNameStyle(RenderNameStyle.AS_IS)
.withParseDialect(...
1
vote
2
answers
633
views
How to insert json string from spark into column of type jsonb in postgres
I have to insert json string from spark (Scala) into column of type JSONB in Postgres. I have to compute this string separately and then add this value as a new column to data frame. So used df....
1
vote
0
answers
700
views
Connecting to Test Container with Postgres Fails
For one of my project, I'm using the Test Containers set up. What I do here is basically create a Postgres image like this:
# To build this Dockerfile run the folloing command
# docker build -t custom-...
1
vote
0
answers
286
views
Creating partitioned table in postgres via Spark JDBC write
I want to write a dataframe to a postgres table via spark jdbc connector. The table i am writing to in postgres needs to be partitioned by a certain column. This is currently how i am writing it. I am ...