Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Track whether each table can be written to (#62203)

Ngoc Khuat75d613549840
diff --git a/e2e/support/cypress_data.js b/e2e/support/cypress_data.js
index 37ba34c0aca..9cd66775bbf 100644
--- a/e2e/support/cypress_data.js
+++ b/e2e/support/cypress_data.js
@@ -23,17 +23,19 @@ export const SAMPLE_DB_ID = 1;
export const SAMPLE_DB_SCHEMA_ID = "1:PUBLIC";
// Use only for e2e helpers and custom commands. Never in e2e tests directly!
+// The ids of these tables are determined by our sync processes, especially the result of (metabase.driver.sql-jdbc.sync.describe-database/describe-database)
+// so any changes that affect the order of the tables returned by that function will change the ids of these tables. A common case is when adding a new key to table metadata
export const SAMPLE_DB_TABLES = {
// old tables
- STATIC_PRODUCTS_ID: 8,
- STATIC_ORDERS_ID: 5,
- STATIC_PEOPLE_ID: 3,
- STATIC_REVIEWS_ID: 4,
+ STATIC_PRODUCTS_ID: 3,
+ STATIC_ORDERS_ID: 4,
+ STATIC_PEOPLE_ID: 6,
+ STATIC_REVIEWS_ID: 8,
// new tables
- STATIC_ACCOUNTS_ID: 6,
- STATIC_ANALYTIC_EVENTS_ID: 1,
- STATIC_FEEDBACK_ID: 2,
- STATIC_INVOICES_ID: 7,
+ STATIC_ACCOUNTS_ID: 5,
+ STATIC_ANALYTIC_EVENTS_ID: 2,
+ STATIC_FEEDBACK_ID: 7,
+ STATIC_INVOICES_ID: 1,
};
// All users and admin groups are the defaults that come with Metabase.
diff --git a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
index 62bb3b71cd1..1cd98b751d2 100644
--- a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
+++ b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
@@ -2192,10 +2192,10 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
expressions: ["Net"],
filters: [
"Product → Title is Doohickey",
- "Product → Vendor is Doohickey",
+ "Reviews - Product → Reviewer is Doohickey",
"ID is 7021",
"Net is equal to -80",
- "Reviews - Product → Reviewer is Doohickey",
+ "Product → Vendor is Doohickey",
"User → Longitude is equal to -80",
],
aggregations: ["Count", "Sum of Total"],
diff --git a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj
index e7ac55fdb72..1f40258b49b 100644
--- a/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj
+++ b/modules/drivers/druid-jdbc/test/metabase/driver/druid_jdbc_test.clj
@@ -23,9 +23,9 @@
:druid-jdbc
(tqpt/with-flattened-dbdef
(testing "describe-database"
- (is (= {:tables #{{:schema "druid", :name "checkins" :description nil}
- {:schema "druid", :name "json" :description nil}
- {:schema "druid", :name "big_json" :description nil}}}
+ (is (= {:tables #{{:schema "druid", :name "checkins" :description nil, :is_writable nil}
+ {:schema "druid", :name "json" :description nil, :is_writable nil}
+ {:schema "druid", :name "big_json" :description nil, :is_writable nil}}}
(driver/describe-database :druid-jdbc (mt/db)))))
(testing "describe-table"
(is (=? {:schema "druid"
diff --git a/modules/drivers/sqlite/test/metabase/driver/sqlite_test.clj b/modules/drivers/sqlite/test/metabase/driver/sqlite_test.clj
index 7ae2d06f45b..fddc2552eba 100644
--- a/modules/drivers/sqlite/test/metabase/driver/sqlite_test.clj
+++ b/modules/drivers/sqlite/test/metabase/driver/sqlite_test.clj
@@ -115,7 +115,8 @@
(defn- default-table-result [table-name]
{:name table-name
:schema nil
- :description nil})
+ :description nil
+ :is_writable nil})
(deftest timestamp-test-db
(let [driver :sqlite]
diff --git a/resources/migrations/057_update_migrations.yaml b/resources/migrations/057_update_migrations.yaml
index 0000095000d..a28be7b16c8 100644
--- a/resources/migrations/057_update_migrations.yaml
+++ b/resources/migrations/057_update_migrations.yaml
@@ -120,6 +120,27 @@ databaseChangeLog:
constraints:
nullable: false
+ - changeSet:
+ id: v57.2025-08-15T10:00:00
+ author: qnkhuat
+ comment: Add metabase_table.is_writable
+ preConditions:
+ - onFail: MARK_RAN
+ - not:
+ - columnExists:
+ tableName: metabase_table
+ columnName: is_writable
+ changes:
+ - addColumn:
+ tableName: metabase_table
+ columns:
+ - column:
+ name: is_writable
+ type: ${boolean.type}
+ remarks: true if current connection can insert, update and delete rows from this table
+ constraints:
+ nullable: true
+
- changeSet:
id: v57.2025-08-21T12:00:00
author: edpaget
diff --git a/src/metabase/driver/postgres.clj b/src/metabase/driver/postgres.clj
index 2209432d183..880ad587d3d 100644
--- a/src/metabase/driver/postgres.clj
+++ b/src/metabase/driver/postgres.clj
@@ -278,10 +278,13 @@
rf
init
(when-let [syncable-schemas (seq (driver/syncable-schemas driver database))]
- (let [have-select-privilege? (sql-jdbc.describe-database/have-select-privilege-fn driver conn)]
+ (let [have-privilege-fn (sql-jdbc.describe-database/have-privilege-fn driver conn)]
(eduction
- (comp (filter have-select-privilege?)
- (map #(dissoc % :type)))
+ (comp (filter #(have-privilege-fn % :select))
+ (map (fn [table]
+ (-> table
+ (dissoc :type)
+ (assoc :is_writable (have-privilege-fn table :write))))))
(get-tables database syncable-schemas nil))))))))))
(defmethod driver/describe-database* :postgres
diff --git a/src/metabase/driver/sql_jdbc/sync/describe_database.clj b/src/metabase/driver/sql_jdbc/sync/describe_database.clj
index d004529e8f5..36a7f14b9a5 100644
--- a/src/metabase/driver/sql_jdbc/sync/describe_database.clj
+++ b/src/metabase/driver/sql_jdbc/sync/describe_database.clj
@@ -160,38 +160,53 @@
["TABLE" "PARTITIONED TABLE" "VIEW" "FOREIGN TABLE" "MATERIALIZED VIEW"
"EXTERNAL TABLE" "DYNAMIC_TABLE"]))
-(defn- schema+table-with-select-privileges
+(defn- build-privilege-map
+ "Build a nested map of schema -> table -> set of permissions from current user table privileges.
+ There are 2 permissions:
+ - :select - self-explained
+ - :write - must have insert, update, and delete permisisons. used for table data editing"
[driver conn]
(->> (sql-jdbc.sync.interface/current-user-table-privileges driver {:connection conn})
- (filter #(true? (:select %)))
- (map (fn [{:keys [schema table]}]
- [schema table]))
- set))
+ (reduce (fn [acc {:keys [schema table select insert update delete]}]
+ (assoc-in acc [schema table]
+ (cond-> #{}
+ select (conj :select)
+ (and insert update delete) (conj :write))))
+ {})))
-(defn have-select-privilege-fn
- "Returns a function that take a map with 3 keys [:schema, :name, :type], return true if we can do a select query on the table.
+(defn have-privilege-fn
+ "Returns a function that takes a map with 3 keys [:schema, :name, :type] and a privilege type,
+ returns true if the table has the specified privilege.
- This function shouldn't be called a `map` or anything alike, instead use it as a cache function like so:
+ Privilege types:
+ - :select - Can read from the table
+ - :write - if table has insert, update, delete permissions
- (let [have-select-privilege-fn* (have-select-privilege-fn driver database conn)
- tables ...]
- (filter have-select-privilege-fn* tables))"
+ This function shouldn't be called with `map` or anything alike, instead use it as a cache function like so:
+
+ (let [privilege-fn (have-privilege-fn driver conn)
+ tables ...]
+ (filter #(privilege-fn % :select) tables))"
[driver conn]
;; `sql-jdbc.sync.interface/have-select-privilege?` is slow because we're doing a SELECT query on each table
;; It's basically a N+1 operation where N is the number of tables in the database
(if (driver/database-supports? driver :table-privileges nil)
- (let [schema+table-with-select-privileges (schema+table-with-select-privileges driver conn)]
- (fn [{schema :schema table :name ttype :type}]
+ (let [privilege-map (build-privilege-map driver conn)]
+ (fn [{schema :schema table :name ttype :type} privilege]
;; driver/current-user-table-privileges does not return privileges for external table on redshift, and foreign
;; table on postgres, so we need to use the select method on them
;;
;; TODO FIXME What the hecc!!! We should NOT be hardcoding driver-specific hacks in functions like this!!!!
(if (#{[:postgres "FOREIGN TABLE"]}
[driver ttype])
- (sql-jdbc.sync.interface/have-select-privilege? driver conn schema table)
- (contains? schema+table-with-select-privileges [schema table]))))
- (fn [{schema :schema table :name}]
- (sql-jdbc.sync.interface/have-select-privilege? driver conn schema table))))
+ (case privilege
+ :select (sql-jdbc.sync.interface/have-select-privilege? driver conn schema table)
+ :write nil) ; Foreign tables typically don't support write operations
+ (contains? (get-in privilege-map [schema table] #{}) privilege))))
+ (fn [{schema :schema table :name} privilege]
+ (case privilege
+ :select (sql-jdbc.sync.interface/have-select-privilege? driver conn schema table)
+ :write nil))))
(defn fast-active-tables
"Default, fast implementation of `active-tables` best suited for DBs with lots of system tables (like Oracle). Fetch
@@ -201,14 +216,17 @@
vs 60)."
[driver ^Connection conn & [db-name-or-nil schema-inclusion-filters schema-exclusion-filters]]
{:pre [(instance? Connection conn)]}
- (let [metadata (.getMetaData conn)
- syncable-schemas (sql-jdbc.sync.interface/filtered-syncable-schemas driver conn metadata
- schema-inclusion-filters schema-exclusion-filters)
- have-select-privilege-fn? (have-select-privilege-fn driver conn)]
+ (let [metadata (.getMetaData conn)
+ syncable-schemas (sql-jdbc.sync.interface/filtered-syncable-schemas driver conn metadata
+ schema-inclusion-filters schema-exclusion-filters)
+ privilege-fn (have-privilege-fn driver conn)]
(eduction (mapcat (fn [schema]
(eduction
- (comp (filter have-select-privilege-fn?)
- (map #(dissoc % :type)))
+ (comp (filter #(privilege-fn % :select))
+ (map (fn [table]
+ (-> table
+ (dissoc :type)
+ (assoc :is_writable (privilege-fn table :write))))))
(db-tables driver metadata schema db-name-or-nil))))
syncable-schemas)))
@@ -221,15 +239,18 @@
Tables, then filter out ones whose schema is in `excluded-schemas` Clojure-side."
[driver ^Connection conn & [db-name-or-nil schema-inclusion-filters schema-exclusion-filters]]
{:pre [(instance? Connection conn)]}
- (let [have-select-privilege-fn? (have-select-privilege-fn driver conn)]
+ (let [privilege-fn (have-privilege-fn driver conn)]
(eduction
(comp
(filter (let [excluded (sql-jdbc.sync.interface/excluded-schemas driver)]
(fn [{table-schema :schema :as table}]
(and (not (contains? excluded table-schema))
(include-schema-logging-exclusion schema-inclusion-filters schema-exclusion-filters table-schema)
- (have-select-privilege-fn? table)))))
- (map #(dissoc % :type)))
+ (privilege-fn table :select)))))
+ (map (fn [table]
+ (-> table
+ (dissoc :type)
+ (assoc :is_writable (privilege-fn table :write))))))
(db-tables driver (.getMetaData conn) nil db-name-or-nil))))
(defn db-or-id-or-spec->database
diff --git a/src/metabase/sync/interface.clj b/src/metabase/sync/interface.clj
index 1564db2b87b..9e59b63c041 100644
--- a/src/metabase/sync/interface.clj
+++ b/src/metabase/sync/interface.clj
@@ -10,6 +10,9 @@
[:map {:closed true}
[:name ::lib.schema.common/non-blank-string]
[:schema [:maybe ::lib.schema.common/non-blank-string]]
+ ;; true if the current connection can make insert, update and delete operations. Only works for drivers that support
+ ;; :table-privileges feature
+ [:is_writable {:optional true} [:maybe :boolean]]
;; for databases that store an estimated row count in system tables (e.g: postgres)
[:estimated_row_count {:optional true} [:maybe :int]]
;; for databases that support forcing query to include a filter (e.g: partitioned table on bigquery)
diff --git a/src/metabase/sync/sync_metadata/tables.clj b/src/metabase/sync/sync_metadata/tables.clj
index fb8bb784133..2331ba7e10a 100644
--- a/src/metabase/sync/sync_metadata/tables.clj
+++ b/src/metabase/sync/sync_metadata/tables.clj
@@ -134,7 +134,8 @@
:database_require_filter (:database_require_filter table)
:display_name (or (:display_name table)
(humanization/name->human-readable-name (:name table)))
- :name (:name table)})))
+ :name (:name table)
+ :is_writable (:is_writable table)})))
(defn create-or-reactivate-table!
"Create a single new table in the database, or mark it as active if it already exists."
@@ -186,7 +187,7 @@
{:active false})))
(def ^:private keys-to-update
- [:description :database_require_filter :estimated_row_count :visibility_type :initial_sync_status])
+ [:description :database_require_filter :estimated_row_count :visibility_type :initial_sync_status :is_writable])
(mu/defn- update-table-metadata-if-needed!
"Update the table metadata if it has changed."
diff --git a/src/metabase/warehouse_schema/models/table.clj b/src/metabase/warehouse_schema/models/table.clj
index e22973cc6b2..e0617624fb6 100644
--- a/src/metabase/warehouse_schema/models/table.clj
+++ b/src/metabase/warehouse_schema/models/table.clj
@@ -317,7 +317,7 @@
(defmethod serdes/make-spec "Table" [_model-name _opts]
{:copy [:name :description :entity_type :active :display_name :visibility_type :schema
:points_of_interest :caveats :show_in_getting_started :field_order :initial_sync_status :is_upload
- :database_require_filter :is_defective_duplicate :unique_table_helper]
+ :database_require_filter :is_defective_duplicate :unique_table_helper :is_writable]
:skip [:estimated_row_count :view_count]
:transform {:created_at (serdes/date)
:archived_at (serdes/date)
diff --git a/test/metabase/driver/mysql_test.clj b/test/metabase/driver/mysql_test.clj
index 1d5d330ba5f..338c188e2ce 100644
--- a/test/metabase/driver/mysql_test.clj
+++ b/test/metabase/driver/mysql_test.clj
@@ -854,3 +854,48 @@
(fn [^java.sql.Connection conn]
(is (true? (sql-jdbc.sync.interface/have-select-privilege?
driver/*driver* conn schema table-name))))))))))))
+
+;; table privileges for mysql currently has bug unfortunately
+#_(deftest sync-writable-test
+ (mt/test-driver :mysql
+ (when-not (mysql/mariadb? (mt/db))
+ (testing "`sync-tables-and-database!` should set is_writable correctly based on table privileges"
+ (tx/drop-if-exists-and-create-db! driver/*driver* "sync_writable_test")
+ (let [details (tx/dbdef->connection-details :mysql :db {:database-name "sync_writable_test"})
+ spec (sql-jdbc.conn/connection-details->spec :mysql details)]
+ (try
+ (doseq [stmt ["CREATE TABLE `readonly_table` (id INTEGER);"
+ "CREATE TABLE `readwrite_table` (id INTEGER);"
+ "CREATE TABLE `fullaccess_table` (id INTEGER);"
+ "CREATE USER 'sync_writable_test_user' IDENTIFIED BY 'password';"]]
+ (jdbc/execute! spec stmt))
+
+ (doseq [stmt ["GRANT SELECT ON sync_writable_test.`readonly_table` TO 'sync_writable_test_user'"
+ "GRANT SELECT, INSERT ON sync_writable_test.`readwrite_table` TO 'sync_writable_test_user'"
+ "GRANT SELECT, INSERT, UPDATE, DELETE ON sync_writable_test.`fullaccess_table` TO 'sync_writable_test_user'"]]
+ (jdbc/execute! spec stmt))
+
+ (let [user-connection-details (assoc details
+ :user "sync_writable_test_user"
+ :password "password"
+ :ssl true
+ :additional-options "trustServerCertificate=true")]
+ (mt/with-temp [:model/Database database {:engine "mysql", :details user-connection-details}]
+ (sync/sync-database! database)
+ (testing "only fullaccess table has writeable permissions"
+ (is (= {"readonly_table" false
+ "readwrite_table" false
+ "fullaccess_table" true}
+ (t2/select-fn->fn :name :is_writable :model/Table :db_id (:id database)))))
+ (testing "After granting full access to all tables and re-syncing"
+ (doseq [table-name ["readonly_table" "readwrite_table"]]
+ (jdbc/execute! spec (format "GRANT INSERT, UPDATE, DELETE ON sync_writable_test.`%s` TO 'sync_writable_test_user'" table-name)))
+
+ (sync/sync-database! database)
+ (is (= {"readonly_table" false
+ "readwrite_table" false
+ "fullaccess_table" true}
+ (t2/select-fn->fn :name :is_writable :model/Table :db_id (:id database)))))))
+
+ (finally
+ (jdbc/execute! spec "DROP USER IF EXISTS 'sync_writable_test_user';"))))))))
diff --git a/test/metabase/driver/postgres_test.clj b/test/metabase/driver/postgres_test.clj
index e11c57dd8f2..09d83d070fc 100644
--- a/test/metabase/driver/postgres_test.clj
+++ b/test/metabase/driver/postgres_test.clj
@@ -1760,3 +1760,50 @@
(fn [^java.sql.Connection conn]
(is (true? (sql-jdbc.sync.interface/have-select-privilege?
driver/*driver* conn schema table-name))))))))))))
+
+(deftest sync-writable-test
+ (mt/test-driver :postgres
+ (testing "`sync-tables-and-database!` should set is_writable correctly based on table privileges"
+ (let [db-name "sync_writable_test"
+ details (tx/dbdef->connection-details :postgres :db {:database-name db-name})]
+ (tx/drop-if-exists-and-create-db! driver/*driver* db-name)
+ #_{:clj-kondo/ignore [:discouraged-var]}
+ (jdbc/with-db-connection [conn (sql-jdbc.conn/connection-details->spec :postgres details)]
+ (try
+ (jdbc/execute! conn "CREATE SCHEMA IF NOT EXISTS sync_test_schema")
+
+ (doseq [stmt ["CREATE TABLE sync_test_schema.readonly_table (id INTEGER);"
+ "CREATE TABLE sync_test_schema.readwrite_table (id INTEGER);"
+ "CREATE TABLE sync_test_schema.fullaccess_table (id INTEGER);"]]
+ (jdbc/execute! conn stmt))
+
+ (jdbc/execute! conn "DROP USER IF EXISTS sync_writable_test_user")
+ (jdbc/execute! conn "CREATE USER sync_writable_test_user WITH PASSWORD 'password'")
+
+ (jdbc/execute! conn "GRANT USAGE ON SCHEMA sync_test_schema TO sync_writable_test_user")
+
+ (jdbc/execute! conn "GRANT SELECT ON sync_test_schema.readonly_table TO sync_writable_test_user")
+ (jdbc/execute! conn "GRANT SELECT, INSERT ON sync_test_schema.readwrite_table TO sync_writable_test_user")
+ (jdbc/execute! conn "GRANT SELECT, INSERT, UPDATE, DELETE ON sync_test_schema.fullaccess_table TO sync_writable_test_user")
+
+ (let [user-connection-details (assoc details
+ :user "sync_writable_test_user"
+ :password "password")]
+ (mt/with-temp [:model/Database database {:engine "postgres", :details user-connection-details}]
+ (sync/sync-database! database)
+ (testing "only fullaccess table has writeable permissions"
+ (is (= {"readonly_table" false
+ "readwrite_table" false
+ "fullaccess_table" true}
+ (t2/select-fn->fn :name :is_writable :model/Table :db_id (:id database)))))
+ (testing "After granting full access to all tables and re-syncing"
+ (doseq [table-name ["readonly_table" "readwrite_table"]]
+ (jdbc/execute! conn (format "GRANT INSERT, UPDATE, DELETE ON sync_test_schema.%s TO sync_writable_test_user" table-name)))
+ (sync/sync-database! database)
+ (is (= {"readonly_table" true
+ "readwrite_table" true
+ "fullaccess_table" true}
+ (t2/select-fn->fn :name :is_writable :model/Table :db_id (:id database)))))))
+ (finally
+ (jdbc/execute! conn "DROP SCHEMA IF EXISTS sync_test_schema CASCADE")
+ (jdbc/execute! conn "DROP USER IF EXISTS sync_writable_test_user"))))))))
diff --git a/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj b/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
index e2c92146ec9..3ec6c5fd70c 100644
--- a/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
+++ b/test/metabase/driver/sql_jdbc/sync/describe_database_test.clj
@@ -83,14 +83,14 @@
sort))))))
(deftest describe-database-test
- (is (= {:tables #{{:name "USERS", :schema "PUBLIC", :description nil}
- {:name "VENUES", :schema "PUBLIC", :description nil}
- {:name "CATEGORIES", :schema "PUBLIC", :description nil}
- {:name "CHECKINS", :schema "PUBLIC", :description nil}
- {:name "ORDERS", :schema "PUBLIC", :description nil}
- {:name "PEOPLE", :schema "PUBLIC", :description nil}
- {:name "PRODUCTS", :schema "PUBLIC", :description nil}
- {:name "REVIEWS", :schema "PUBLIC", :description nil}}}
+ (is (= {:tables #{{:name "USERS", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "VENUES", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "CATEGORIES", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "CHECKINS", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "ORDERS", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "PEOPLE", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "PRODUCTS", :schema "PUBLIC", :description nil, :is_writable nil}
+ {:name "REVIEWS", :schema "PUBLIC", :description nil, :is_writable nil}}}
(sql-jdbc.describe-database/describe-database :h2 (mt/id)))))
(defn- describe-database-with-open-resultset-count!
diff --git a/test/metabase/driver/sql_jdbc_test.clj b/test/metabase/driver/sql_jdbc_test.clj
index 01845a17348..502395e4df8 100644
--- a/test/metabase/driver/sql_jdbc_test.clj
+++ b/test/metabase/driver/sql_jdbc_test.clj
@@ -21,7 +21,7 @@
(deftest ^:parallel describe-database-test
(is (= {:tables (set (for [table ["CATEGORIES" "VENUES" "CHECKINS" "USERS" "ORDERS" "PEOPLE" "PRODUCTS" "REVIEWS"]]
- {:name table, :schema "PUBLIC", :description nil}))}
+ {:name table, :schema "PUBLIC", :description nil, :is_writable nil}))}
(driver/describe-database :h2 (mt/db)))))
(deftest describe-fields-sync-with-composite-pks-test
diff --git a/test/metabase/warehouse_schema/api/table_test.clj b/test/metabase/warehouse_schema/api/table_test.clj
index d04b699da1d..d01c7e1f101 100644
--- a/test/metabase/warehouse_schema/api/table_test.clj
+++ b/test/metabase/warehouse_schema/api/table_test.clj
@@ -65,7 +65,8 @@
:field_order "database"
:view_count 0
:metrics []
- :segments []}))
+ :segments []
+ :is_writable nil}))
(defn- field-defaults []
(merge
diff --git a/test/metabase/warehouses/api_test.clj b/test/metabase/warehouses/api_test.clj
index 00c3b3724ab..d24c3c3455e 100644
--- a/test/metabase/warehouses/api_test.clj
+++ b/test/metabase/warehouses/api_test.clj
@@ -639,7 +639,7 @@
:features (map u/qualified-name (driver.u/features :h2 (mt/db)))
:tables [(merge
(mt/obj->json->obj (mt/object-defaults :model/Table))
- (t2/select-one [:model/Table :created_at :updated_at] :id (mt/id :categories))
+ (t2/select-one [:model/Table :created_at :updated_at :is_writable] :id (mt/id :categories))
{:schema "PUBLIC"
:name "CATEGORIES"
:display_name "Categories"
diff --git a/test_resources/serialization_baseline/databases/My Database/tables/Schemaless Table/Schemaless Table.yaml b/test_resources/serialization_baseline/databases/My Database/tables/Schemaless Table/Schemaless Table.yaml
index 74b63a7e08b..18638e2a819 100644
--- a/test_resources/serialization_baseline/databases/My Database/tables/Schemaless Table/Schemaless Table.yaml
+++ b/test_resources/serialization_baseline/databases/My Database/tables/Schemaless Table/Schemaless Table.yaml
@@ -21,3 +21,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CATEGORIES/CATEGORIES.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CATEGORIES/CATEGORIES.yaml
index b94ad7015a8..5bb397709d8 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CATEGORIES/CATEGORIES.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CATEGORIES/CATEGORIES.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CHECKINS/CHECKINS.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CHECKINS/CHECKINS.yaml
index 8053e917195..b3df940f0ea 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CHECKINS/CHECKINS.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/CHECKINS/CHECKINS.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/ORDERS/ORDERS.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/ORDERS/ORDERS.yaml
index d192e78bacb..2e7ed95690f 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/ORDERS/ORDERS.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/ORDERS/ORDERS.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PEOPLE/PEOPLE.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PEOPLE/PEOPLE.yaml
index 78f8743d840..1c756a6db65 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PEOPLE/PEOPLE.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PEOPLE/PEOPLE.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PRODUCTS/PRODUCTS.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PRODUCTS/PRODUCTS.yaml
index 0e3efc05552..7b1a6bc7edf 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PRODUCTS/PRODUCTS.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/PRODUCTS/PRODUCTS.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/REVIEWS/REVIEWS.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/REVIEWS/REVIEWS.yaml
index 924563abec2..89a95c970d3 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/REVIEWS/REVIEWS.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/REVIEWS/REVIEWS.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/USERS/USERS.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/USERS/USERS.yaml
index a57ded6ec29..ef9fe1c2bbd 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/USERS/USERS.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/USERS/USERS.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/VENUES/VENUES.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/VENUES/VENUES.yaml
index b6beb8236af..e37b57df32a 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/VENUES/VENUES.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/schemas/PUBLIC/tables/VENUES/VENUES.yaml
@@ -23,3 +23,4 @@ serdes/meta:
archived_at: null
database_require_filter: null
deactivated_at: null
+is_writable: null
diff --git a/test_resources/serialization_baseline/databases/test-data (h2)/tables/linked_table/linked_table.yaml b/test_resources/serialization_baseline/databases/test-data (h2)/tables/linked_table/linked_table.yaml
index 9f237f43caf..cab78cd5043 100644
--- a/test_resources/serialization_baseline/databases/test-data (h2)/tables/linked_table/linked_table.yaml
+++ b/test_resources/serialization_baseline/databases/test-data (h2)/tables/linked_table/linked_table.yaml
@@ -18,6 +18,7 @@ serdes/meta:
model: Database
- id: linked_table
model: Table
-database_require_filter: null
archived_at: null
+database_require_filter: null
deactivated_at: null
+is_writable: null