Skip to content
HoneyEQL is a Clojure library enables you to query database using the EDN Query Language.
Branch: master
Clone or download

Latest commit

Latest commit 8d307e6 Apr 4, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Dec 1, 2019 bump version Apr 4, 2020
deps.edn bump dependencies Feb 26, 2020
pom.xml bump version Apr 4, 2020


HoneyEQL is a Clojure library enables you to query database using the EDN Query Language(EQL). HoneyEQL transforms the EQL into single efficient SQL and query the database using next.jdbc.

HoneyEQL powers GraphQLize.

Clojars Project

CAUTION: HoneyEQL is at its early stages now. It is not production-ready yet!. It currently supports Postgres (9.4 & above) and MySQL (8.0 & above) only.

Supported Features

  • Query by Primary Key(s)
  • Query entire table
  • Query 1-1, 1-n and m-n relationships

Upcoming Features

  • Filters
  • Pagination
  • Sorting
  • Aggregate Queries
  • DML Queries

Table of contents

Getting Started

Let's get started by adding HoneyEQL to your project.

Clojars Project

In addition, you will need to add dependencies for the JDBC drivers you wish to use for whatever databases you are using and preferably a connection pooling library like HikariCP or c3p0.

This documentation uses deps and assumes you are connecting to the the sakila database created from this JOOQ's example repository.

;; deps.edn
{:paths ["src"]
 :deps  {org.graphqlize/honeyeql     {:mvn/version "0.1.0-alpha7"}
         hikari-cp                   {:mvn/version "2.10.0"}
         org.postgresql/postgresql   {:mvn/version "42.2.8"}
         mysql/mysql-connector-java  {:mvn/version "8.0.19"}}}

The next step is initializing the db-adapter using either db-spec-map or

Postgres with db-spec map

(ns core
  (:require [honeyeql.db :as heql-db]))

(def db-adapter (heql-db/initialize {:dbtype   "postgres"
                                     :dbname   "sakila"
                                     :user     "postgres"
                                     :password "postgres"}))

MySQL with db connection pool

(ns core
  (:require [honeyeql.db :as heql-db]
            [hikari-cp.core :as hikari]))

(def db-adapter
      {:server-name       "localhost"
       :maximum-pool-size 1
       :jdbc-url          "jdbc:mysql://localhost:3306/sakila"
       :driver-class-name "com.mysql.cj.jdbc.MysqlDataSource"
       :username          "root"
       :password          "mysql123"})))

Then we query the database using either query-single to retrieve a single item or query to retrieve multiple items.

(ns core
  (:require ; ...
            [honeyeql.core :as heql]))

; ...
  [{[:actor/actor-id 1] [:actor/first-name
; returns
{:actor/first-name "PENELOPE"
 :actor/last-name  "GUINESS"}

  [{[] [:language/name]}])
; returns
({:language/name "English"} {:language/name "Italian"}
 {:language/name "Japanese"} {:language/name "Mandarin"}
 {:language/name "French"} {:language/name "German"})

Supports all kind of relationships as well

one-to-one relationship

  [{[:city/city-id 3] [:city/city
                       {:city/country [:country/country]}]}])

one-to-many relationship

  [{[:country/country-id 2] [:country/country
                             {:country/cities [:city/city]}]}])

many-to-many relationship

  [{[:actor/actor-id 148] [:actor/first-name
                           {:actor/films [:film/title]}]}])


Limit and Offset

  [{'([] {:limit 2 :offset 2}) 
   [:actor/actor-id :actor/first-name]}])
; returns
({:actor/actor-id 3, :actor/first-name "ED"}
 {:actor/actor-id 4, :actor/first-name "JENNIFER"})

Both limit and offset can be applied on one-to-many and many-to-many relationships as well.

  [{[:country/country-id 2] 
     ; one-to-many relationship
     {'(:country/cities {:limit 2 :offset 2}) 
  [{[:actor/actor-id 148] 
    ; many-to-many relationship
    {'(:actor/films {:limit 1 :offset 2})


In addition to querying, HoneyEQL supports quering the metadata of the database also.

(heql/meta-data db-adapter)
; returns
{:entities ...
 :attributes ...
 :namespaces ...}

The visual representation of the above data for the Postgres Sakila database is available in the below links

You can’t perform that action at this time.