Comments (7)
I have a solution for this using the Scala 2.10 reflection API. Loading custom Slick drivers works (I tested the MariaDB JDBC driver with the MySQL Slick driver).
However, there is the issue of configuration: Right now, the only play-slick configuration option is slick.default="models.*"
(or similar). Like this, slick.default
is already defined as a string, and it is impossible to set a key slick.default.driver
.
Also, SlickDDLPlugin
reads all children of the slick
configuration key, so a simple hack like setting slick.driver=scala.slick.H2Driver
won't work.
Possible solutions would be to work around this with two root-level configuration keys, à la
slick.default="models.*"
slickdrivers.default="scala.slick.driver.MySQLDriver"
I think this is sort of hacky, though. A cleaner solution would be to change the configuration to something like this:
slick.default.models="models.*"
slick.default.driver="scala.slick.H2Driver"
Any thoughts on this?
from play-slick.
I like it :) there is a possibility you get a conflict between the url driver and this setting but since it is optional it is fair to assume that the user knows what he is doing.
Want to create a PR?
Carsten Brachem [email protected] wrote:
I have a solution for this using the Scala 2.10 reflection API. Loading
custom Slick drivers works (I tested the MariaDB JDBC driver with the
MySQL Slick driver).
However, there is the issue of configuration: Right now, the only
play-slick configuration option isslick.default="models.*"
(or
similar). Like this,slick.default
is already defined as a string,
and it is impossible to set a keyslick.default.driver
.
Also,
SlickDDLPlugin
reads all children of theslick
configuration key, so a simple hack
like settingslick.driver=scala.slick.H2Driver
won't work.Possible solutions would be to work around this with two root-level
configuration keys, à laslick.default="models.*"
slickdrivers.default="scala.slick.driver.MySQLDriver"I think this is sort of hacky, though. A cleaner solution would be to
change the configuration to something like this:slick.default.models="models.*"
slick.default.driver="scala.slick.H2Driver"Any thoughts on this?
Reply to this email directly or view it on GitHub:
#25 (comment)
Sent from my Android device with K-9 Mail. Please excuse my brevity.
from play-slick.
I agree on the possible conflict: this is the same thing that you have with plain Slick. If you wanted to, you could choose the wrong database driver (or create a custom nonsense driver). It's great of play-slick that it removes the chance to get it wrong for most configurations, but if someone wants to, they should be able to choose their Slick driver.
But:
I cannot create a PR yet because I don't know how to proceed on the configuration issue. I have suggested two possible solutions, one with the two root-level configuration keys, and the other one that is cleaner (everything is unter slick.*
), but changes the current configuration and breaks all current projects using play-slick.
I'd happily implement either of these solutions (or something completely different). But this issue is too big for me to decide on; also, I don't have the necessary insight into the project and its plans to make an informed suggestion. What's your stand on this?
from play-slick.
Ok - right. i will have a look at it tomorrow
from play-slick.
I've done that in my fork: v6ak@3690072
There is the pull request: #110
from play-slick.
Awesome stuff! Thanks for this! Will review on Wednesday and put out a new if there is no hick-ups.
"Vít Šesták" [email protected] wrote:
I've done that in my fork:
v6ak@3690072There is the pull request:
#110
Reply to this email directly or view it on GitHub:
#25 (comment)
Sent from my Android device with K-9 Mail. Please excuse my brevity.
from play-slick.
Closing this since PR is merged
from play-slick.
Related Issues (20)
- java.lang.NoSuchMethodError: com.zaxxer.hikari.HikariConfig.setInitializationFailFast HOT 10
- Connections not being returned to pool on transaction failure HOT 10
- Cannot acquire connection on many "refresh"
- play 2.7 docs mention play-slick 3.0.0 HOT 2
- Restart connection pools when DB credentials expire HOT 2
- Bump Play version to 2.7.1 HOT 1
- Evolutions fails silently looping the `InvalidDatabaseRevision` for MySQL HOT 1
- Publish for Play 2.7 + slick 3.2? HOT 2
- Unique Indexes break referential integrity. HOT 2
- Evolution script is skipped if there is any Cyrillic character HOT 1
- Why not write Evolutions in Scala ?
- Evolutions are not completed when I access the database programmatically. HOT 15
- Update master Readme to show latest version 5.0.0 HOT 1
- At 5.0.0, Samples don't work HOT 6
- In Play 2.8.2, slick.dbs.default.profile config throws ClassNotFound exception when using custom Profile HOT 4
- Play evolutions throwing error when trying to run it for the first time HOT 10
- please release new version HOT 5
- Unsupported operations post upgrading to scala 2.12 HOT 1
- On startup, evolultion button to apply is disappeared HOT 6
- 6.0.0 Release? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from play-slick.