Skip to content
Snippets Groups Projects
Unverified Commit 5f400a76 authored by metamben's avatar metamben Committed by GitHub
Browse files

Remove SQL Server rowcount-override support (#44029)

Fixes #39789.
parent 431a9395
No related branches found
No related tags found
No related merge requests found
......@@ -44,10 +44,6 @@ The password for the username that you use to connect to the database.
Metabase automatically tries to connect to databases with SSL first, then without if that doesn't work. If it's possible to connect to your database with an SSL connection, Metabase will make that the default setting for your database. If you prefer to connect without this layer of security, you can always change this setting later, but we highly recommend keeping SSL turned on to keep your data secure.
### ROWCOUNT Override
If left empty, Metabase will apply a 2000 row limit to query results. You can set a different limit here, or set to 0 for "unconstrained".
### Use an SSH tunnel
See our [guide to SSH tunneling](../ssh-tunnel.md).
......
......@@ -23,10 +23,6 @@ driver:
- password
- cloud-ip-address-info
- ssl
- name: rowcount-override
display-name: ROWCOUNT Override
placeholder: 0
required: false
- ssh-tunnel
- advanced-options-start
- merge:
......
......@@ -780,12 +780,3 @@
(defmethod driver.sql/->prepared-substitution [:sqlserver Boolean]
[driver bool]
(driver.sql/->prepared-substitution driver (if bool 1 0)))
(defmethod driver/normalize-db-details :sqlserver
[_ database]
(if-let [rowcount-override (-> database :details :rowcount-override)]
;; if the user has set the rowcount-override connection property, it ends up in the details map, but it actually
;; needs to be moved over to the settings map (which is where DB local settings go, as per #19399)
(-> (update database :details #(dissoc % :rowcount-override))
(update :settings #(assoc % :unaggregated-query-row-limit rowcount-override)))
database))
......@@ -12,7 +12,6 @@
[metabase.driver.sql-jdbc.execute :as sql-jdbc.execute]
[metabase.driver.sql.query-processor :as sql.qp]
[metabase.driver.sqlserver :as sqlserver]
[metabase.models :refer [Database]]
[metabase.query-processor :as qp]
[metabase.query-processor.compile :as qp.compile]
[metabase.query-processor.interface :as qp.i]
......@@ -23,8 +22,7 @@
[metabase.test :as mt]
[metabase.test.util.timezone :as test.tz]
[metabase.util.date-2 :as u.date]
[next.jdbc]
[toucan2.tools.with-temp :as t2.with-temp]))
[next.jdbc]))
(set! *warn-on-reflection* true)
......@@ -368,49 +366,6 @@
{:aggregation [[:count]]
:breakout [[:field $date {:temporal-unit unit}]]}))))))))))))
(deftest ^:parallel max-results-bare-rows-test
(mt/test-driver :sqlserver
(testing "Should support overriding the ROWCOUNT for a specific SQL Server DB (#9940)"
(t2.with-temp/with-temp [Database db {:name "SQL Server with ROWCOUNT override"
:engine "sqlserver"
:details (-> (:details (mt/db))
;; SQL server considers a ROWCOUNT of 0 to be unconstrained
;; we are putting this in the details map, since that's where connection
;; properties go in a client save operation, but it will be MOVED to the
;; settings map instead (which is where DB-local settings go), via the
;; driver/normalize-db-details implementation for :sqlserver
(assoc :rowcount-override 0))}]
;; TODO FIXME -- This query probably shouldn't be returning ANY rows given that we're setting the LIMIT to zero.
;; For now I've had to keep a bug where it always returns at least one row regardless of the limit. See comments
;; in [[metabase.query-processor.middleware.limit/limit-xform]].
(mt/with-db db
(is (= 3000 (-> {:query (str "DECLARE @DATA AS TABLE(\n"
" IDX INT IDENTITY(1,1),\n"
" V INT\n"
")\n"
"DECLARE @STEP INT \n"
"SET @STEP = 1\n"
"WHILE @STEP <=3000\n"
"BEGIN\n"
" INSERT INTO @DATA(V)\n"
" SELECT 1\n"
" SET @STEP = @STEP + 1\n"
"END \n"
"\n"
"DECLARE @TEMP AS TABLE(\n"
" IDX INT IDENTITY(1,1),\n"
" V INT\n"
")\n"
"INSERT INTO @TEMP(V)\n"
"SELECT V FROM @DATA\n"
"\n"
"SELECT COUNT(1) FROM @TEMP\n")}
mt/native-query
qp/userland-query
qp/process-query
mt/rows
ffirst))))))))
(deftest filter-by-datetime-fields-test
(mt/test-driver :sqlserver
(testing "Should match datetime fields even in non-default timezone (#30454)"
......
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