This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns demo | |
(:require | |
[metabase.driver :as driver] | |
[metabase.driver.sql.query-processor :as sql.qp] | |
[metabase.lib.core :as lib] | |
[metabase.lib.metadata :as lib.metadata] | |
[metabase.lib.metadata.jvm :as lib.metadata.jvm] | |
[metabase.lib.test-metadata :as meta] | |
[metabase.lib.test-util :as lib.tu] | |
[metabase.query-processor.compile :as qp.compile] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -euo pipefail | |
for file in `find . -type f -name '*.clj' -or -name '*.cljc' -or -name '*.cljs'`; do \ | |
wc -l "$file" | | |
perl -ne 'my @parts = /(^\d+)\s(.*$)/; printf("%05d %s\n", $parts[0], $parts[1]);' | |
done | | |
sort -r | | |
head -n 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; it's a map that hates if you try to get the key `:dataset` from it. NOCOMMIT | |
(declare ->DatasetHatingMap) | |
(defn- check-for-dataset-key [k] | |
(when (= k :dataset) | |
(throw (ex-info ":dataset is deprecated, use :type instead!" {})))) | |
(p/def-map-type DatasetHatingMap [m] | |
(get [_this k default-value] | |
(check-for-dataset-key k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns metabase.util.kebab-hating-map | |
"This is a map type that catches attempts to get `:kebab-case` values from it. In prod, it logs a warning and gets the | |
value for the equivalent `snake_case` key; in tests and dev it throws an Exception. | |
This is here so we can catch driver code is still supposed to be using Toucan instances rather than MLv2 Metadata. | |
This is intended to be only temporary; after everything in the QP is converted to MLv2 we can remove this." | |
(:require | |
[clojure.string :as str] | |
[metabase.config :as config] | |
[metabase.driver :as driver] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns metabase.util.snake-hating-map | |
"This is a map type that catches attempts to get `:snake_case` values from it. In prod, it logs a warning and gets the | |
value for the equivalent `kebab-case` key; in tests and dev it throws an Exception. | |
This is here so we can catch driver code that needs to be updated in 48+ to use MLv2 metadata rather than Toucan | |
instances. After 51 we can remove this, everything should be updated by then." | |
(:require | |
[clojure.string :as str] | |
[metabase.config :as config] | |
[metabase.driver :as driver] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns metabase.lib.metadata.jvm | |
"Implementation(s) of [[metabase.lib.metadata.protocols/MetadataProvider]] only for the JVM." | |
(:require | |
[clojure.set :as set] | |
[metabase.lib.dispatch :as lib.dispatch] | |
[metabase.lib.metadata :as lib.metadata] | |
[metabase.lib.metadata.cached-provider :as lib.metadata.cached-provider] | |
[metabase.lib.metadata.jvm.magic-map :as lib.metadata.jvm.magic-map] | |
[metabase.lib.metadata.protocols :as lib.metadata.protocols] | |
[metabase.lib.schema.id :as lib.schema.id] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.StackOverflowError: | |
... | |
clojure.core/partial/fn core.clj: 2641 | |
... | |
clojure.core/comp/fn core.clj: 2586 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mbql-clause/define-tuple-mbql-clause :foo :- :type/Boolean | |
#_number int?) | |
(malli.core/validate | |
:mbql.clause/foo | |
[:foo {:lib/uuid (str (random-uuid))} 1]) | |
;; => true | |
(malli.core/validate :mbql.clause/foo [:foo 1]) | |
;; => false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns metabase.lib.schema.mbql-clause | |
(:require | |
[metabase.lib.schema.common :as common] | |
[metabase.util.malli.registry :as mr])) | |
(defonce ^:private ^{:doc "map of clause keyword -> schema"} clause-schema-registry | |
(atom {})) | |
(defn- keyword-schema | |
"Build the schema for `::keyword`, for a valid MBQL clause type keyword." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns metabase.util.log.capture | |
(:require [clojure.string :as str])) | |
(def ^:dynamic *capture-logs-fn* | |
(constantly nil)) | |
(defn level->int [level] | |
(case level | |
:explode 0 | |
:fatal 1 |