Fork me on GitHub
#sql
<
2018-05-10
>
Drew Verlee02:05:58

Including the jdbc in my java project seems to have fixed the problem.

Drew Verlee02:05:36

Which I understand why that would fix the problem, but i’m a tad confused why it wasn’t already included. But i’m in uncharted territory with java interopt.

Drew Verlee03:05:00

somewhat offtopic though 🙂

seancorfield03:05:06

What do you mean by "the jdbc"?

Drew Verlee03:05:46

right. I’m falling asleep over here. I meant including the postgres JDBC driver in my dependencies: - https://mvnrepository.com/artifact/postgresql/postgresql/9.0-801.jdbc4 `

Drew Verlee03:05:47

gradle file:

dependencies {
    ...
    compile group: 'postgresql', name: 'postgresql', version: '9.0-801.jdbc4'
    compile files('/Users/drewverlee/personal/postgres-mock/fk-gen/target')
}
`

seancorfield03:05:57

If your library had been a properly packaged artifact with a pom.xml, Gradle should have pulled in all its dependencies -- but you just used the JAR, right? Without the pom? And your JAR didn't have any of the transient dependencies?

Drew Verlee03:05:29

> just the Jar. Without the pom? Yep. just the uberjar. > And your JAR didn’t have any of the transient dependencies? I thought uberjars contained all the dependencies. I’m going to revisit this in the morning and read up on how to publish to my local maven repo and probably cover some very basic information on java dependency management, poms, maven, etc..

orestis16:05:19

Are there any libraries there that would write DDLs and simple querys/inserts for me? I’ve seen Korma but I recall people suggested it was buggy?

tanzoniteblack17:05:09

For queries: korma works, but it's highly opinionated on how you managed your DB connections (i.e. globals) and makes it somewhat hard to validate the query plan. Personally, I think that https://github.com/jkk/honeysql is a solid choice for going from clojure data structures to queries, as is just writing the queries directly with https://www.hugsql.org/ . You might just try the raw clojure.java.jdbc though, for simple CRUD operations it's surprisingly effective

tanzoniteblack17:05:04

for generating DDLs: I'm not really aware of any clojure libraries that will actually generate the DDL's from a model, like what Django from python or ruby on rails will do for you

orestis17:05:44

Thanks! HoneySQL looks nice, I never looked at it closely.

orestis17:05:44

I think the fact that I’ve been used to Django creating DDLs for me has made me rusty on that aspect, and I want to avoid it - but perhaps adding indexes, constraints, generating index names and so on is a hassle and should be handled in a library.

tanzoniteblack17:05:39

I work at a site with a pretty decent amount of traffic ( http://www.yummly.com , who's currently hiring clojure devs...), and I agree that managing the DDL's by hand is a hassle...but a necessary one to ensure performance

tanzoniteblack17:05:22

we actually use korma, honeysql, and hugsql, sometimes even within the same project. They all have certain areas where they excel, and so we try to use the right tool for the job whenever possible, and they play pretty well together

orestis17:05:57

Yes, every time I needed to get some performance back I had to dive into Django’s docs to see how I can add complex indexes etc — but it’s still annoying to have to do it from the first minute.

myguidingstar17:05:40

@orestis you should learn to write sql for DDL operations, it's worth it. S-expressions offer no benefit there

3Jane17:05:45

ymmv but the more I use ORMs and automated tools, the more I want to have access to plain sql

myguidingstar17:05:26

imo insert/update is often simple and jdbc is often enough for the task

orestis17:05:02

@myguidingstar The “basic” DDL stuff is not painful. It’s the constraints that come after that I find annoying, esp. for pretty basic stuff. I need to brush up again on the syntax though, perhaps there are some convenience that I have missed.

tanzoniteblack17:05:29

I do agree that the django model is super convenient though 🙂 , but once your project gets large enough, with enough need for performance, it gets in the way. @orestis if you ever need help or advice, feel free to ask. Either here, or a PM with me

orestis17:05:11

My experience so far is that: Django can generate a pretty complex DDL for you, but sucks for complex queries. Ecto generates pretty limited DDLs but can generate nice queries (looks like a bit like HoneySQL).

orestis17:05:44

Perhaps what I’m after is a boilerplate generator? I can take if from there 🙂

orestis17:05:20

Some graphical tool that could give me 80% of my DDL that I could then tweak by hand, hmmmm.

seancorfield18:05:59

DDL tends to be the most DB-specific aspect of SQL, which is why java.jdbc offers only the bare minimum (`create-table-ddl` -- where you're mostly on your own for how to specify the column types! -- and drop-table-ddl). And also why HoneySQL hasn't added support yet.

seancorfield18:05:13

I agree with everyone here who said writing DDL by hand is a necessary skill since the variations are complex and you need to get it exactly right.

seancorfield18:05:50

If you're using PostgreSQL, I believe there's an extension library for HoneySQL that supports DDL? @orestis

bja20:05:27

honeysql-postgres supports a lot of the DDL

bja20:05:22

I haven't used it for its ddl support, but it does register several other sql extensions like support for INSERT ... ON CONFLICT ...

orestis21:05:34

Ah, I will check it out @seancorfield — thanks!