Compare commits

...

8 Commits

Author SHA1 Message Date
Braden Shepherdson
72c2825b09 [DataScript] Reworked comments with Marginalia formatting 2024-05-31 13:11:09 -04:00
Braden Shepherdson
fec347a308 [DataScript] Add remove/replace, a centerpiece of this PoC 2024-05-31 13:11:09 -04:00
Braden Shepherdson
4eca28126d [DataScript] Add in> paths for slicker testing
These enable navigating the query under construction to build new
clauses with a convenient shorthand.

It also exposed some busted `with-stage` logic in `join`, which I
fixed.
2024-05-31 13:11:09 -04:00
Braden Shepherdson
93e4bdd7e7 [DataScript] Support queries with multiple stages 2024-05-31 13:11:09 -04:00
Braden Shepherdson
561b18b8f5 [DataScript] Model "sources" and explicit joins 2024-05-31 13:11:09 -04:00
Braden Shepherdson
75897d6dd9 [DataScript] Implement return-columns and visible-columns 2024-05-31 11:56:33 -04:00
Braden Shepherdson
5988ab83ca [DataScript] Expand schema and library to handle all clauses
Except order-by and limit, which I forgot about.
2024-05-31 11:54:21 -04:00
Braden Shepherdson
bed41e7a14 [DataScript] First steps for using DataScript to hold queries 2024-05-31 11:53:38 -04:00
9 changed files with 2485 additions and 6 deletions

View File

@@ -332,6 +332,7 @@
clojure.tools.namespace.find ns.find
clojure.tools.namespace.parse ns.parse
colorize.core colorize
datascript.core d
environ.core env
hf.depstar.api depstar
hiccup.core hiccup

View File

@@ -106,6 +106,7 @@
clojure.core.async/take!
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
datascript.core/transact!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.pulse/send-pulse!
metabase.query-processor.store/store-database!

View File

@@ -64,6 +64,7 @@
compojure/compojure {:mvn/version "1.7.1" ; HTTP Routing library built on Ring
:exclusions [ring/ring-codec]}
crypto-random/crypto-random {:mvn/version "1.2.1"} ; library for generating cryptographically secure random bytes and strings
datascript/datascript {:mvn/version "1.6.4"}
dk.ative/docjure {:mvn/version "1.19.0" ; excel export
:exclusions [org.apache.poi/poi
org.apache.poi/poi-ooxml]}
@@ -361,6 +362,7 @@
cider/piggieback {:mvn/version "0.5.3"}
cljs-bean/cljs-bean {:mvn/version "1.9.0"}
com.lambdaisland/glogi {:mvn/version "1.3.169"}
datascript/datascript {:mvn/version "1.6.4"}
io.github.metabase/hawk {:git/url "https://github.com/metabase/hawk"
:git/sha "490c9b04fbf5861dbd47c0c5281dad2d113bd285"}
org.clojars.mmb90/cljs-cache {:mvn/version "0.1.4"}

View File

@@ -15,8 +15,10 @@
:dev {:output-dir "target/cljs_dev/"
:compiler-options {:reader-features #{:cljs-dev}}}
:compiler-options {:reader-features #{:cljs-release}
:source-map true}
:source-map true
:externs ["datascript/externs.js"]}
:entries [metabase.lib.column-group
metabase.lib.datascript
metabase.lib.js
metabase.lib.limit
metabase.lib.types.isa

File diff suppressed because it is too large Load Diff

View File

@@ -72,7 +72,7 @@
metadata-ids))
(defn- tables [metadata-provider cache]
(let [fetched-tables #(lib.metadata.protocols/tables metadata-provider)]
(let [fetched-tables (lib.metadata.protocols/tables metadata-provider)]
(doseq [table fetched-tables]
(store-in-cache! cache [:metadata/table (:id table)] table))
fetched-tables))

View File

@@ -338,9 +338,11 @@
(defn- tables [database-id]
(t2/select :metadata/table
:db_id database-id
:active true
:visibility_type [:not-in #{"hidden" "technical" "cruft"}]))
:db_id database-id
:active true
{:where [:or
[:is :visibility_type nil]
[:not-in :visibility_type #{"hidden" "technical" "cruft"}]]}))
(defn- metadatas-for-table [metadata-type table-id]
(case metadata-type

File diff suppressed because it is too large Load Diff

View File

@@ -3,11 +3,21 @@
(:require [metabase.util :as u])
(:require-macros [metabase.test-runner.assert-exprs.approximately-equal-js]))
(defn- dispatch-keyword [x]
(let [upstream (u/dispatch-type-keyword x)]
;; Fall back to using JS classes as opposed to :dispatch-type/*.
;; This enables matching on eg. `datascript.impl.entity/Entity`.
(if (and (= upstream :dispatch-type/*)
(not (object? x)) ; Not a vanilla object
(instance? js/Object x)) ; But some other JS class
(type x)
upstream)))
(defmulti =?-diff
"Multimethod to use to diff two things with `=?`."
{:arglists '([expected actual])}
(fn [expected actual]
[(u/dispatch-type-keyword expected) (u/dispatch-type-keyword actual)]))
[(dispatch-keyword expected) (dispatch-keyword actual)]))
;;;; Default method impls