From 0a8c1349059eb2a305f9f6fc8518a2027a666179 Mon Sep 17 00:00:00 2001 From: Daniel Westendorf Date: Fri, 25 Oct 2024 13:22:11 -0600 Subject: [PATCH] Add method for querying materialized views --- .../connection_adapters/clickhouse/schema_statements.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb index a4e73ff..a275477 100644 --- a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb +++ b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb @@ -72,6 +72,12 @@ def views(name = nil) result['data'].flatten end + def materialized_views(name = nil) + result = do_system_execute("SHOW TABLES WHERE engine = 'MaterializedView'", name) + return [] if result.nil? + result['data'].flatten + end + def functions result = do_system_execute("SELECT name FROM system.functions WHERE origin = 'SQLUserDefined'") return [] if result.nil?