372 questions
0
votes
1
answer
24
views
Is there a way to parse multiple case classes from a join
I have the following case classes representing entities:
case class A(id: Long, name: String)
case class B(id: Long, someField: String)
val parser = Macro.namedParser[A] ~ Macro.namedParser[B]
val ...
0
votes
1
answer
127
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
14
views
Proper way to handle SQL errors in anorm?
I see that executeQuery returns a SqlQueryResult, which has a statementWarning() that returns Option[SQLWarning].
Is this the only place I should check to see whether my insert failed? The doc ...
0
votes
1
answer
273
views
Not able to connect to spark thrift server via jdbc driver in play framework with anorm
I am trying to connect my spark thrift server using play framework via anorm.
Play framework version - 2.8.18
Connecting to jdbc as explained here
Anorm - 2.7.0
Spark thrift server version - spark 3....
0
votes
1
answer
60
views
Pattern matching using regex with Scala Anorm
I'm Using Scala(2.11) and playframework(2.3) and trying to run a query using a helper function to get results through pattern matching. The function is as follows
def resultsfunc() = {
val ...
1
vote
1
answer
331
views
Scala List[Unit] to List[String] conversion
This is a pretty basic issue but I couldn't find a solution after spending an hour on it. I'm trying to query database to get a list of values through Scala Anorm ORM. I want to convert the result to ...
1
vote
1
answer
146
views
Anorm replacement of params gives error on usage of aggregate functions
Table structure -
create table test
(month integer,
year integer,
thresholds decimal(18,2)
);
Static insert for simulation -
insert into test(month,year,threshold) values(4,2021,100),(5,2021,98),(6,...
0
votes
1
answer
79
views
Scala anorm running query to postgreSQL with set role command
I need to execute query in PostgreSQL using anorm. In order to handle authorization I have to set role along with query. My query is as follows.
set role myuser; select country from country_list
This ...
0
votes
0
answers
53
views
Parsing different queries with same parser anorm
I was trying to parse some different SQL queries using one anorm parser.
Some of the queries will return a,b,c as their result. Eventually, one of the query will return
a,b,c,d,e.
The result is ...
0
votes
0
answers
91
views
Parameters are not getting replaced in Anorm prepared query for embedded text queries
We have a use-case where we need to pivot the result set of a query to columns for insert statement. For that, we are using crosstab which takes text sql as a parameter.
so the query might ...
0
votes
1
answer
124
views
Anorm with SQL expressions as parameter values
I am trying to create this SQL statement with Anorm in Scala. I am using a Postgres DB.
insert into my_table (coords) values (ST_GeomFromText('POINT(26.9484 24.03937)',4326)
I have tried this code:
...
0
votes
1
answer
76
views
Anorm - generic insert
Is there a way to use Anorm like a regular ORM? I'd like to have a method that just inserts an element provided.
def insert[T](element: T)(implicit connection: Connection) = {
element.insert(...
1
vote
1
answer
124
views
Anorm (Scala) How to return Json from a joint table?
I'm trying to link 2 tables together and return json from it, unfortunatly the documentations and online are not very clear about this, so if you know how to solve this please provide a snippet that I ...
1
vote
2
answers
651
views
How do I insert JSON into a postgres table using Anorm?
I'm getting a runtime exception when trying to insert a JSON string into a JSON column. The string I have looks like """{"Events": []}""", the table has a column defined as status JSONB NOT NULL. I ...
1
vote
1
answer
221
views
How to fix the unresolved dependencies for Anorm in scala version 2.13
I would like to import anorm dependencies on to my scala play frame work project but it doesn't support on my current scala version. What should I do?
libraryDependencies += "com.typesafe.play" %% "...