This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-21
Channels
- # announcements (13)
- # babashka (63)
- # babashka-sci-dev (64)
- # beginners (37)
- # biff (1)
- # calva (10)
- # cider (7)
- # clj-kondo (15)
- # cljsrn (6)
- # clojure (26)
- # clojure-dev (10)
- # clojure-europe (34)
- # clojure-france (9)
- # clojure-nl (2)
- # clojure-norway (36)
- # clojure-uk (5)
- # clojurescript (142)
- # community-development (1)
- # conjure (3)
- # datalevin (5)
- # datalog (2)
- # datomic (5)
- # events (11)
- # fulcro (40)
- # gratitude (9)
- # guix (32)
- # honeysql (10)
- # jobs (2)
- # lsp (32)
- # malli (15)
- # meander (5)
- # membrane (43)
- # missionary (3)
- # nextjournal (9)
- # off-topic (38)
- # pathom (3)
- # polylith (30)
- # portal (78)
- # programming-beginners (4)
- # quil (6)
- # re-frame (20)
- # reagent (21)
- # remote-jobs (2)
- # shadow-cljs (7)
- # tools-deps (6)
- # xtdb (23)
Hello, I'm trying to generate the following (postgres)SQL with honeysql:
CREATE TEMPORARY TABLE temp_table AS
TABLE display_impressions_reach_by_line_test
WITH NO DATA;
I've been playing around with argument orderings to create-table-as
but no luck
(-> {:create-table-as [:temporary :table :temp_table :display_impressions_reach_by_line_test]}
sql/format)
;; => ["CREATE TEMPORARY TABLE TEMP_TABLE TABLE display_impressions_reach_by_line_test AS"]
I can't figure out how I'm supposed to order the symbols in the argument vectorCan you open a Github issue with details so I can take a look at the exact syntax and what needs to be done? I'm not sure right now whether what you're asking for can be done directly in HoneySQL or whether some enhancements are required. Thanks, @U8STBJZU0
Should I add this as a ticket? It hasn't been added yet, so happy to just do that 🙂
@U11EL3P9U Thanks! Yes, please. Thanks for the returning
doc ticket, BTW.
It took me a while to figure out what that SQL syntax was meant to be -- and then I discovered that PostgreSQL has a TABLE
command that is equivalent to SELECT * FROM
and then it made more sense:
dev=> (println (sql/format {:create-table-as [:temporary :temp_table] :select :* :from :display_impressions_reach_by_line_test :with-data false} {:pretty true}))
[
CREATE TEMPORARY TABLE temp_table AS
SELECT *
FROM display_impressions_reach_by_line_test
WITH NO DATA
]
HoneySQL doesn't support a :table
clause right now so that select/from is the best you can do.
I've added :table
as a clause (on develop) for the next release - see that issue.