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
(defn- unwrap-connection ^PrestoConnection [^C3P0ProxyConnection conn] | |
(.unwrap conn PrestoConnection)) | |
(defn set-timezone! [conn ^String zone-id] | |
(.setTimeZoneId (unwrap-connection conn) zone-id)) | |
(defn get-timestamp-utc [^com.facebook.presto.jdbc.PrestoResultSet rset ^Integer index] | |
(let [method (doto (.getDeclaredMethod com.facebook.presto.jdbc.PrestoResultSet | |
"getTimestamp" | |
(into-array Class [Integer/TYPE com.facebook.presto.jdbc.internal.joda.time.DateTimeZone])) |
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.test.data.presto-jdbc | |
"Presto JDBC driver test extensions." | |
(:require [clojure.string :as str] | |
[metabase.config :as config] | |
[metabase.connection-pool :as connection-pool] | |
[metabase.driver :as driver] | |
[metabase.driver.sql-jdbc.execute :as sql-jdbc.execute] | |
[metabase.test.data.interface :as tx] | |
[metabase.test.data.sql :as sql.tx] | |
[metabase.test.data.sql-jdbc :as sql-jdbc.tx] |
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
(defmulti my-multimethod | |
keyword) | |
(derive ::x ::keyword) | |
(derive ::y ::keyword) | |
(defmethod my-multimethod ::x | |
[_] | |
::x) |
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
(defn unsorted [password] | |
(let [lines (atom 0)] | |
(with-open [reader (java.io.BufferedReader. (java.io.FileReader. (io/file (io/resource "common_passwords.txt"))))] | |
{:bad? (boolean | |
(some | |
(fn [a-password] | |
(swap! lines inc) | |
(= a-password password)) | |
(iterator-seq (.. reader lines iterator)))) | |
:n @lines}))) |
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
--- updated.old.json 2021-04-30 15:50:09.720000000 -0700 | |
+++ updated.json 2021-04-30 15:59:20.510000000 -0700 | |
@@ -14,6 +14,7 @@ | |
"1.14.0-0": "zip+https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14-win_x64.zip", | |
"1.14.0": "zip+https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-win_x64.zip", | |
"1.13.0-6": "zip+https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-win_x64.zip", | |
+ "1.13.0-5.1": "zip+https://cdn.azul.com/zulu/bin/zulu13.35.51-ca-jdk13.0.5.1-win_x64.zip", | |
"1.13.0-5": "zip+https://cdn.azul.com/zulu/bin/zulu13.35.17-ca-jdk13.0.5-win_x64.zip", | |
"1.13.0-4": "zip+https://cdn.azul.com/zulu/bin/zulu13.33.25-ca-jdk13.0.4-win_x64.zip", | |
"1.13.0-3": "zip+https://cdn.azul.com/zulu/bin/zulu13.31.11-ca-jdk13.0.3-win_x64.zip", |
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
2021-04-16 14:25:10,346 DEBUG middleware.log :: GET /api/card/8717 200 8.8 ms (5 DB calls) App DB connections: 5/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued) | |
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 8.3 ms (5 DB calls) App DB connections: 9/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued) | |
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 8.6 ms (5 DB calls) App DB connections: 9/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued) | |
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 9.9 ms (5 DB calls) App DB connections: 4/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued) | |
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 9.0 ms (5 DB calls) App DB connections: 3/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total ac |
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
(defun cam/-next-sexp-on-current-line-p () | |
"Whether the next sexp after point is one the current line." | |
(let ((next-sexp (save-excursion | |
(paredit-forward) | |
(current-line)))) | |
(= next-sexp (current-line)))) | |
(defun cam/-clojure-in-expect-form-p () | |
"Whether we are currently in a expect form." | |
(save-excursion |
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.driver.mbql | |
(:require [cheshire.core :as json] | |
[metabase.driver :as driver] | |
[metabase.driver.sql-jdbc.connection :as sql-jdbc.conn] | |
[metabase.mbql.normalize :as normalize] | |
[metabase.models :refer [Database]] | |
[metabase.query-processor :as qp] | |
[metabase.query-processor.store :as qp.store] | |
[toucan.db :as db])) |
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
(defmigration ^{:added "0.39.0"} migrate-map-regions | |
(reduce | |
(fn [_ {card-id :id, {map-region :map.region, :as viz-settings} :visualization_settings}] | |
(when (= map-region "us_states") | |
(let [new-settings (update viz-settings :map.region str/upper-case)] | |
(db/update! Card card-id :visualization_settings new-settings)))) | |
nil | |
(db/select-reducible [Card :id :visualization_settings]))) |
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
lein update-in : assoc :dependencies '^:replace [[org.clojure/clojure "1.10.1"] [org.liquibase/liquibase-core "3.5.5"] [org.postgresql/postgresql "42.2.8"]]' -- \ | |
update-in : dissoc :aliases -- \ | |
with-profile -run \ | |
run -m liquibase.integration.commandline.Main \ | |
--changeLogFile=resources/migrations/000_migrations.yaml \ | |
--url='jdbc:postgresql://localhost:5432/metabase?user=cam&password=cam' \ | |
dbDoc target/liquibase |