Module: ActiveRecord::ConnectionAdapters::Trino::SchemaStatements
- Included in:
- ActiveRecord::ConnectionAdapters::TrinoAdapter
- Defined in:
- lib/active_record/connection_adapters/trino/schema_statements.rb
Instance Method Summary collapse
- #clear_column_cache! ⇒ Object
- #columns(table_name) ⇒ Object
- #data_sources ⇒ Object (also: #tables)
- #foreign_keys(_table_name) ⇒ Object
- #indexes(_table_name) ⇒ Object
- #primary_key(_table_name) ⇒ Object
- #table_exists?(table_name) ⇒ Boolean (also: #data_source_exists?)
- #view_exists?(_view_name) ⇒ Boolean
- #views ⇒ Object
Instance Method Details
#clear_column_cache! ⇒ Object
51 52 53 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 51 def clear_column_cache! @column_definitions = nil end |
#columns(table_name) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 7 def columns(table_name) table = table_name.to_s declared = ActiveRecord::Trino.static_columns[table] return build_static_columns(declared) if declared if bulk_column_reflection? column_definitions.fetch(table, []) else build_columns(run_trino_query(table_columns_query(table)).rows) end end |
#data_sources ⇒ Object Also known as: tables
19 20 21 22 23 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 19 def data_sources return ActiveRecord::Trino.static_columns.keys if static_schema? run_trino_query("SHOW TABLES").rows.map(&:first) end |
#foreign_keys(_table_name) ⇒ Object
39 40 41 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 39 def foreign_keys(_table_name) [] end |
#indexes(_table_name) ⇒ Object
35 36 37 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 35 def indexes(_table_name) [] end |
#primary_key(_table_name) ⇒ Object
31 32 33 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 31 def primary_key(_table_name) nil end |
#table_exists?(table_name) ⇒ Boolean Also known as: data_source_exists?
26 27 28 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 26 def table_exists?(table_name) data_sources.include?(table_name.to_s) end |
#view_exists?(_view_name) ⇒ Boolean
47 48 49 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 47 def view_exists?(_view_name) false end |
#views ⇒ Object
43 44 45 |
# File 'lib/active_record/connection_adapters/trino/schema_statements.rb', line 43 def views [] end |