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
packagemodelimportcom.datastax.driver.core.{Cluster, Session}
importconnection.ConnectionProviderimportentity.PageImpressionimporttroy.dsl._importtroy.driver.DSL._importscala.concurrent.FutureclassPageImpressionByYearMonth(connection: ConnectionProvider) {
importscala.concurrent.ExecutionContext.Implicits.globalvalcluster= connection.cluster
implicitvalsession:Session= connection.session
valkeyspace="analytics"valtableName="pageimpressionbyyearmonth"valgetByYearMonth= withSchema {
(year: Int, month: Int) =>cql""" SELECT * FROM analytics.pageimpressionbyyearmonth WHERE year = $year AND month = $month
""".prepared.executeAsync.as(PageImpression)
}
defget(year: Int, month: Int):Future[Seq[PageImpression]] = getByYearMonth(year, month)
}
The schema file is in probject/src/main/resources/schema.cql and project/src/test/resources/schema.cql. I also checked probject/src/main/resources/schmea/schema.cql and probject/src/test/resources/schema.cql. I think there is something wrong with the relative path. Instead of a relative path it seems like it uses a absolute path.
The text was updated successfully, but these errors were encountered:
the single-file mode, it looks for single file resources/schema.cql
the versioned mode, it looks for multiple files resources/schema/01.cql, resources/schema/02.cql, etc ..
It should attempt first to try the versioned mode, if it can't find the folder, it attempts to load the single-file mode.
I am not sure what exactly went wrong in your case, but it seems to get stuck at the versioned mode, I'll mark it as a bug to check later.
For now, I'd suggest to rename your schema file to be "resources/schema/01.cql", this will probably fix the issue. If not, please update me in a reply.
Ok, I've figured it out. It is a documentation issue.
You need this line in your build.sbt to allow the macro to read the resources folder at compile time.
I get the following error:
Let's take a look into the code.
The schema file is in probject/src/main/resources/schema.cql and project/src/test/resources/schema.cql. I also checked probject/src/main/resources/schmea/schema.cql and probject/src/test/resources/schema.cql. I think there is something wrong with the relative path. Instead of a relative path it seems like it uses a absolute path.
The text was updated successfully, but these errors were encountered: