Fork me on GitHub
#sql
<
2018-04-30
>
fabrao14:04:50

Hello all, I´m using Hikari CP as database pool and I want to get primary keys of a table. I saw this

(j/with-db-metadata [md db-spec]
  (j/metadata-result (.getTables md nil nil nil (into-array ["TABLE" "VIEW"]))))
but how can I get metadata? I tried .getMetadata from HikariDatasource but there is not this method.

donaldball14:04:33

From a Datasource, you’ll want to first call .getConnection, then you should be able to call .getMetadata on that

fabrao14:04:15

@donaldball it worked, many thanks !!!

🍰 4