From dcea6ce5c9f90d5d5e0ff8c9f0406f9d5863c834 Mon Sep 17 00:00:00 2001 From: Chris Bisnett Date: Sun, 28 Jul 2024 19:00:29 -0400 Subject: [PATCH] Add connection view helper --- .../connection_adapters/clickhouse/schema_statements.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb index de1d939f..fb30918e 100644 --- a/lib/active_record/connection_adapters/clickhouse/schema_statements.rb +++ b/lib/active_record/connection_adapters/clickhouse/schema_statements.rb @@ -133,6 +133,13 @@ def with_yaml_fallback(value) # :nodoc: end end + def views(name = nil) + result = do_system_execute("SHOW TABLES WHERE engine = 'View'", name) + + return [] if result.nil? + result['data'].flatten + end + private # Make HTTP request to ClickHouse server