-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relationship with Opaleye? #9
Comments
No, Opaleye has been open sourced by @tomjaguarpaw. This is a repository with our layer on top of opaleye, which we open sourced so other people can use or copy it, and hopefully parts might be integrated in core opaleye at some point. |
Can we rally some support (moral AND dev) for merging this code (or similar code which solves these problems) into opaleye? I'm not sure how can anyone use Opalaye in a serious production project without first having to rebuild this layer. |
I think @tomjaguarpaw used opaleye in production without this layer... I think the main reason it hasn't been merged is that it isn't clear that everyone would want to do everything this way. Also, this package does multiple things. Which ones in particular do you think are indispensable? |
Which means that the lower-level API and the higher-level API shouldn't be tightly coupled (to allow people to build their own higher-level API if they have strong opinions). But, I strongly believe that a higher level API, which has the following parts working out-of-the-box should exist (either as a part of Opaleye itself, or a closely associated library):
As I continue building out my domain API more, I'm sure I'll come across more common use-cases. |
It would be great if you could gather your ideas in one place.
Perhaps you could write one :) |
Want me to limit the noise to one place :)
I'm afraid I don't have enough Haskell chops to do that. However, between opalaye-sot, silk-opaleye, and opaleye-trans, don't we have everything we need? If you can guide the project through a high level design doc, I will volunteer to write code, and docs/tutorials. |
I don't want anything to get lost.
Sounds like it will be a great partnership :) |
Don't we already have everything we need then? Most of the features you describe exist in silk-opaleye, which is a library loosely coupled with opaleye itself :D |
More seriously: based on my experience with silk-opaleye and opaleye itself, I think that the use of native Haskell data types should be merged into opaleye itself. It brings a lot more type safety to writing your queries, which is one of the design goals of opaleye (no more mixing up
|
Where do you think I would've copied all the code from to submit to @tomjaguarpaw ;)
I feel Opaleye should support both workflows - barebones type-safe updates (current) and FRM/RRM based (read a record from DB, update a field, and write it back) With respect to logging, how do I put Opaleye in verbose mode and view all the SQL queries it's firing? |
There is no verbose mode but you can see the queries that it sends with the functions in https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/src/Opaleye/Sql.hs and https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/src/Opaleye/Manipulation.hs |
Alternatively you can configure postgres to log all the queries that it's performing. You can use |
Isn't it easier to have you app-server log SQL queries along with other important things, like incoming request, handler invoked, tenant and user ID, time taken to respond, etc. Isn't depending solely on PG logging an inferior programmer UX? |
@hesselink you're accessing the call stack via an implicit param. Do you need to compile with profiling turned on? Performance impact? |
Yes, it might be easier to log in the app server. It should be easy to build on top of the sql printing function and the normal run function. Then you can also decide on your own logging library/method and format instead of opaleye choosing one for you (or having some complicated pluggable system). For the call stacks you don't need profiling turned on. That also means that you only get the part of the call stack that you explicitly annotate with the implicit parameters. But that's ok, we mostly want the immediate calling function anyway. The other option is to label all your queries manually, I've done that as well. I've even labelled subparts of very large queries. I haven't noticed any performance impact of the call stacks, and I'd suspect it will be dwarfed by most normal computations, let alone running a database query. |
Would a pluggable system really be that complicated? If we have a ReaderT for the DB connection, can't we just add the logging function to it as well? |
@tomjaguarpaw are you on-board with extending the Opaleye API to make common tasks easier? |
How can I say "no"?! |
You can, if you want to. You're the project-dictator :) |
@tomjaguarpaw any update on this? Also I found https://github.com/byteally/dbrecord-opaleye which seems to be solving similar problems. |
Well, I'm open to improving Opaleye, yes :) |
Which direction would you like to take Opaleye in? |
That's an extremely broad question! Suffice it to say I am happy to add functionality to Opaleye that makes it more convenient as long as it doesn't compromise the general principles (type safety, composability). Beyond that, it's completely up to other people what they want to see in the library. Suggestions are welcome. PRs are even more welcome. |
Let me collate all the ideas in the Opaleye repo itself. I'll close this issue shortly. |
@tomjaguarpaw did you get my ping via https://gist.github.com/saurabhnanda/c2dc9526f9f99e6c10f92120326ee8a6 -- awaiting your blessings. |
@hesselink I believe this project is not on Hackage, right? Is there an easy way to generate the Hackage docs for the public API and host them somewhere (even it's just type signatures)? |
There's a RC here https://hackage.haskell.org/package/girella-1.0.0/candidate but it seems to be missing docs |
What's girella? Public name for Silk-Opaleye, I'm guessing. |
same package, new name |
@bergmark In that case, how easy is it to generate docs for girella? I'm not well versed with Hackage, yet. |
I don't think hackage builds docs for candidates. You can build them locally of course with |
@hesselink @bergmark unable to fetch girella via stack. Using
|
To use a candidate from stack you need to use the url to the tar.gz, but it's probably easier to use this repo instead. Also remember to use the silk branch on our opaleye fork. |
Possible to share the exact lines to add to stack? |
So, https://github.com/silkapp/haskell-opaleye/tree/silk and https://github.com/silkapp/silk-opaleye/tree/girella go together? What's been changed in the opalaye in that branch? |
Our opaleye forks is opaleye 0.3 with some cherry-picked changes. I think everything we did has been contributed back to opaleye. It's a very unfortunate thing that we have this fork. The reason is the change in update behavior in tomjaguarpaw/haskell-opaleye#92. |
Has Opaleye been open-sourced by Silk?
The text was updated successfully, but these errors were encountered: