问题
Is there any way to use slick with database views? When I run the standard code generator, nothing about views are listed. I also can't seem to find anything in the documentation mentioning the ability (or lack thereof) to do so.
回答1:
Yes it is perfectly possible to use views, but you need to tweak code generation a tiny bit. See here for more specific information: https://github.com/slick/slick/issues/1022 (comment of "mobiworx")
回答2:
If you follow the link provided by tfh, the following code snippet worked for me:
slick.jdbc.meta.MTable.getTables(None, None, None, Some(Seq("VIEW","TABLE")))
来源:https://stackoverflow.com/questions/28077228/scala-slick-database-views