Skip to content
Snippets Groups Projects
Commit a21f49d6 authored by Cam Saul's avatar Cam Saul
Browse files

Merge branch 'release-0.31.1' into merge-release-0.31.1 :twisted_rightwards_arrows:

[ci drivers]
parent ad31691f
No related branches found
No related tags found
No related merge requests found
......@@ -165,7 +165,8 @@
;; but not for `top-level` queries (since it's not needed there)
(defmethod sql.qp/apply-top-level-clause [:sqlserver :order-by] [driver _ honeysql-form {:keys [limit], :as query}]
(let [add-limit? (and (not limit) (pos? sql.qp/*nested-query-level*))
honeysql-form ((get-method sql.qp/apply-top-level-clause :sql-jdbc) driver :order-by honeysql-form query)]
honeysql-form ((get-method sql.qp/apply-top-level-clause [:sql-jdbc :order-by])
driver :order-by honeysql-form query)]
(if-not add-limit?
honeysql-form
(sql.qp/apply-top-level-clause driver :limit honeysql-form (assoc query :limit qp.i/absolute-max-results)))))
......
......@@ -665,7 +665,7 @@
:filter [:= [:field-id (data/id :venues :category_id)] 50]}}))))
;; make sure that if a nested query includes joins queries based on it still work correctly (#8972)
(datasets/expect-with-engines (non-timeseries-engines-with-feature :nested-queries :foreign-keys)
(datasets/expect-with-drivers (non-timeseries-drivers-with-feature :nested-queries :foreign-keys)
[[31 "Bludso's BBQ" 5 33.8894 -118.207 2]
[32 "Boneyard Bistro" 5 34.1477 -118.428 3]
[33 "My Brother's Bar-B-Q" 5 34.167 -118.595 2]
......
......@@ -210,23 +210,23 @@
(when-not (contains? @existing-datasets database-name)
(try
(u/auto-retry 10
;; if the dataset failed to load successfully last time around, destroy whatever was loaded so we start
;; again from a blank slate
(u/ignore-exceptions
(destroy-dataset! database-name))
(create-dataset! database-name)
;; do this in parallel because otherwise it can literally take an hour to load something like
;; fifty_one_different_tables
(u/pdoseq [tabledef table-definitions]
(load-tabledef! database-name tabledef))
(swap! existing-datasets conj database-name)
(println (u/format-color 'green "[OK]")))
;; if the dataset failed to load successfully last time around, destroy whatever was loaded so we start
;; again from a blank slate
(u/ignore-exceptions
(destroy-dataset! database-name))
(create-dataset! database-name)
;; do this in parallel because otherwise it can literally take an hour to load something like
;; fifty_one_different_tables
(u/pdoseq [tabledef table-definitions]
(load-tabledef! database-name tabledef))
(swap! existing-datasets conj database-name)
(println (u/format-color 'green "[OK]")))
;; if creating the dataset ultimately fails to complete, then delete it so it will hopefully work next time
;; around
(catch Throwable e
(u/ignore-exceptions
(println (u/format-color 'red "Failed to load BigQuery dataset '%s'." database-name))
(destroy-dataset! database-name))
(println (u/format-color 'red "Failed to load BigQuery dataset '%s'." database-name))
(destroy-dataset! database-name))
(throw e))))))
(defmethod tx/aggregate-column-info :bigquery
......
......@@ -84,7 +84,7 @@
`qualified-name-components`and `quote-name`.
(qualify+quote-name [driver \"my-db\" \"my-table\"]) -> \"my-db\".\"dbo\".\"my-table\""
{:arglists '([driver database-name? table-name? field-name?])}
{:arglists '([driver database-name table-name? field-name?])}
tx/dispatch-on-driver-with-test-extensions
:hierarchy #'driver/hierarchy)
......
......@@ -70,14 +70,16 @@
;; important because we're limited to a quota of 30 DBs on RDS.
(defmethod tx/before-run :sqlserver [_]
(let [connection-spec (sql-jdbc.conn/connection-details->spec :sqlserver
(tx/dbdef->connection-details :sqlserver :server nil))
leftover-dbs (mapv :name (jdbc/query connection-spec "SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('tempdb', 'master', 'model', 'msdb', 'rdsadmin');"))]
(tx/dbdef->connection-details :sqlserver :server nil))
leftover-dbs (map :name (jdbc/query
connection-spec
(str "SELECT name "
"FROM master.dbo.sysdatabases "
"WHERE name NOT IN ('tempdb', 'master', 'model', 'msdb', 'rdsadmin');")))]
(with-redefs [+suffix identity]
(doseq [db leftover-dbs]
(u/ignore-exceptions
(printf "Deleting leftover SQL Server DB '%s'...\n" db)
;; Don't try to kill other connections to this DB with SET SINGLE_USER -- some other instance (eg CI) might be using it
(jdbc/execute! connection-spec [(format "DROP DATABASE \"%s\";" db)])
(println "[ok]"))))))
(printf "Deleting leftover SQL Server DB '%s'...\n" db)
;; Don't try to kill other connections to this DB with SET SINGLE_USER -- some other instance (eg CI) might be using it
(jdbc/execute! connection-spec [(format "DROP DATABASE \"%s\";" db)])
(println "[ok]"))))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment