Fork me on GitHub
#sql
<
2019-12-16
>
tianshu05:12:35

I want to rename the primary key column as :db/id in the result set, is there a simple global way?

seancorfield07:12:39

@doglooksgood Not really. Neither next.jdbc nor clojure.java.jdbc know anything about your primary keys. If you always follow a naming convention in every table, you could write a builder to do it I guess.

seancorfield07:12:14

:db/id feels like a domain-level distinction that you're trying to create so perhaps you need to think about separating your domain representation from your persistence representation? In the latter, qualifying columns by the database table name makes sense and may or may not make sense in the domain model so some sort of translation layer would be appropriate. Depends what you are trying to do I guess.

tianshu07:12:05

@seancorfield make sense, I'm start rethinking this problem. It seems :db/id is not a good name.

seancorfield07:12:25

I think there's definitely value in distinguishing your :person/id from your :address/id for example...

dharrigan10:12:27

I wonder how this might work with next jdbc?

dharrigan10:12:44

Non blocking jdbc

seancorfield16:12:26

Oracle formally stopped their official work on an async version of JDBC recently saying that fibers were the right solution. This seems to be something a lot less official?

seancorfield16:12:08

It's not compatible with JDBC so none of the Clojure wrappers for JDBC will work with it right @dharrigan?

dharrigan16:12:19

Yeah, it's a community driven project.