Module: Spectacles::SchemaStatements::VerticaAdapter
- Includes:
- AbstractAdapter
- Defined in:
- lib/spectacles/schema_statements/vertica_adapter.rb
Instance Method Summary
collapse
#create_materialized_view, #create_view, #create_view_statement, #drop_materialized_view, #drop_view, #drop_view_statement, #materialized_view_build_query, #materialized_view_exists?, #materialized_views, #refresh_materialized_view, #refresh_materialized_view_concurrently, #supports_materialized_views?, #view_exists?
Instance Method Details
#view_build_query(view, name = nil) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/spectacles/schema_statements/vertica_adapter.rb', line 16
def view_build_query(view, name = nil)
q = <<-SQL
SELECT view_definition FROM v_catalog.views WHERE table_name = '#{view}'
SQL
select_value(q, name) or raise "No view called #{view} found"
end
|
#views(name = nil) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/spectacles/schema_statements/vertica_adapter.rb', line 8
def views(name = nil)
q = <<-SQL
SELECT table_name FROM v_catalog.views
SQL
execute(q, name).map { |row| row["table_name"] }
end
|