This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-09
Channels
- # aws (1)
- # babashka (61)
- # bangalore-clj (5)
- # beginners (83)
- # biff (2)
- # calva (4)
- # cider (6)
- # clara (5)
- # clj-kondo (72)
- # cljs-dev (31)
- # cljsrn (28)
- # clojure (8)
- # clojure-australia (1)
- # clojure-europe (19)
- # clojure-france (1)
- # clojure-losangeles (21)
- # clojure-nl (2)
- # clojure-spec (2)
- # clojure-uk (9)
- # clojurescript (13)
- # clojureverse-ops (5)
- # code-reviews (1)
- # conjure (7)
- # cursive (4)
- # datascript (2)
- # datomic (8)
- # depstar (1)
- # emacs (3)
- # etaoin (1)
- # events (3)
- # exercism (7)
- # fulcro (6)
- # girouette (2)
- # graalvm (125)
- # honeysql (19)
- # integrant (1)
- # jobs (12)
- # lsp (1)
- # numerical-computing (1)
- # off-topic (23)
- # portal (12)
- # practicalli (1)
- # re-frame (35)
- # reitit (5)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (51)
- # tools-deps (14)
- # vim (3)
- # xtdb (20)
Hi chat, how would you add a frame clause
on window definitions using honey? i.e.
SELECT ...
sum(amount) over (PARTITION BY fruit ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
FROM fruit_sale
i've actually written support for the frame clause recently. if there's still interest, I can open a PR for it
sadly, it's fairly lengthy given how complex it is, but it works well for us
@achan961117 That's more specific than the :partition-by
syntax that HoneySQL supports right now. What DB is that for?
Could you open an issue on GitHub with details and a link to the DB's docs for PARTITION BY
and I'll see what I can do next time I'm working on OSS (in a week or two, I expect).
it’s for postgres, I realised it’s pretty specific usecases so I’m reading up the docs on register-clause!
now
here’s the postgres docs for reference https://www.postgresql.org/docs/11/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS
Put it in an issue 🙂
It's like the absolute opposite of Clojure in a database 😛
Is there a way to deactivate the transform of “-” into “_” in table names? BigQuery uses dashes in project names, and the table name is in the form projectName.datasetName.tableName
(sql/format (sql-h/create-table :test-dash))
=> ["CREATE TABLE test_dash"]
(sql/format (sql-h/create-table :test-dash) {:quoted true})
=> ["CREATE TABLE \"test-dash\""]
Thank you I’ve tried that but there is another problem, I need two dots in my table name, like project-dashed.dataset.table
I’ve tried
(sql/format (sql-h/create-table :project-dashed.dataset/table) {:quoted true})
=> ["CREATE TABLE \"project_dashed.dataset\".\"table\""]
(sql/format (sql-h/create-table :project-dashed.dataset.table) {:quoted true})
=> ["CREATE TABLE \"project-dashed\".\"dataset\""]
;; it works but the table name disapeared
(sql/format (sql-h/create-table "project-dashed.dataset.table") {:quoted true})
Execution error (NullPointerException) at honey.sql/namespace (sql.cljc:154).
null
@U0CL38MU1 Looks like it is actually two bugs compounded here. After I extended :create-table
's syntax, it no longer processes strings correctly for the table name, which was supposed to be the way to handle this, but there's also a bug in format-entity
that doesn't handle multi-segment names in string properly. https://github.com/seancorfield/honeysql/issues/353
That's fixed on develop now if you want to try it out via git deps but I need to do a pass over the documentation to make sure the behavior is accurately reflected there (and probably to add notes about using strings for complex, qualified entity names).
awesome thank you @U04V70XH6 I’ll try that
i've actually written support for the frame clause recently. if there's still interest, I can open a PR for it