You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow for changing tableName enabling re-use of behaviors.
Actual behavior
// failsclassFoo(tableName: String) {
defexample():List[PgTable] = {
valquery=
schemaQuery[PgTable](tableName)
...
}
}
// val query = schemaQuery[PgTable]("NewTableName")... works as expected
Above will fail to compile. Fair since tableName is not known at compile-time. I've used dynamicSchemaQuery[A](tableName) as a work-around. I'm hoping for some way to get at compile-time compilation of queries (for the perceived performance improvement since dynamic query documentation mentions a performance hit).
Motivation
Moving our system into a cluster that will not allow DocumentDB (which our system is based on). Decided on AWS RDS Postgres and Quill. Because we are moving from DocumentDB it seemed natural to use a
to represent the layout of our many collections (now tables) and make use of Postgres's json operations. I created a basic PgRepository[A: Encoder: Decoder](tableName: String, quill: PostgresJdbcContext[Literal]) to handle most of the work. I wouldn't be adverse to using a renamed case class with same shapeless shape to handle tableName but that would also mean duplicating every service class for a new table with boilerplate def basicRepoMethod(id: String): A = { val q = query[NextTableName]... for every table.
Steps to reproduce the behavior
Happy to work up a gist or example repo if needed.
Workaround
None found (and looked at schemaMeta, etc).
With more knowledge I would make a plugin that generated the boilerplate needed for my list of tableNames against PgTable but that is beyond me.
I get that this is a niche request, a result of macro behavior, and not how one normally uses Postgres. Wanted to document the request in case it's not as difficult as I'm thinking it is.
@getquill/maintainers
The text was updated successfully, but these errors were encountered:
Version:
4.8.4
Module:
quill-jdbc
Database:
postgresql
Desired Behavior
Allow for changing tableName enabling re-use of behaviors.
Actual behavior
Above will fail to compile. Fair since tableName is not known at compile-time. I've used
dynamicSchemaQuery[A](tableName)
as a work-around. I'm hoping for some way to get at compile-time compilation of queries (for the perceived performance improvement since dynamic query documentation mentions a performance hit).Motivation
Moving our system into a cluster that will not allow DocumentDB (which our system is based on). Decided on AWS RDS Postgres and Quill. Because we are moving from DocumentDB it seemed natural to use a
to represent the layout of our many collections (now tables) and make use of Postgres's json operations. I created a basic
PgRepository[A: Encoder: Decoder](tableName: String, quill: PostgresJdbcContext[Literal])
to handle most of the work. I wouldn't be adverse to using a renamed case class with same shapeless shape to handletableName
but that would also mean duplicating every service class for a new table with boilerplatedef basicRepoMethod(id: String): A = { val q = query[NextTableName]...
for every table.Steps to reproduce the behavior
Happy to work up a gist or example repo if needed.
Workaround
None found (and looked at schemaMeta, etc).
With more knowledge I would make a plugin that generated the boilerplate needed for my list of tableNames against PgTable but that is beyond me.
I get that this is a niche request, a result of macro behavior, and not how one normally uses Postgres. Wanted to document the request in case it's not as difficult as I'm thinking it is.
@getquill/maintainers
The text was updated successfully, but these errors were encountered: