Class: DataConduit::Adapters::TrinoRepository
- Inherits:
-
Object
- Object
- DataConduit::Adapters::TrinoRepository
- Includes:
- DataWarehouseRepository
- Defined in:
- lib/data_conduit/adapters/trino_repository.rb
Constant Summary
Constants included from DataWarehouseRepository
DataWarehouseRepository::DEFAULT_TRANSFORM_OPTIONS
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #execute(sql_query) ⇒ Object
-
#initialize(table_name, conditions = nil, config = {}) ⇒ TrinoRepository
constructor
A new instance of TrinoRepository.
- #query(sql_query = nil) ⇒ Object
Methods included from DataWarehouseRepository
Constructor Details
#initialize(table_name, conditions = nil, config = {}) ⇒ TrinoRepository
Returns a new instance of TrinoRepository.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 15 def initialize(table_name, conditions = nil, config = {}) @table_name = table_name @conditions = conditions @config = default_config.merge(config) @server = @config[:server] @user = @config[:user] @password = @config[:password] @catalog = @config[:catalog] @schema = @config[:schema] validate_config! end |
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def catalog @catalog end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def conditions @conditions end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def config @config end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def password @password end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def schema @schema end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def server @server end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def table_name @table_name end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
13 14 15 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 13 def user @user end |
Instance Method Details
#execute(sql_query) ⇒ Object
33 34 35 36 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 33 def execute(sql_query) response_data = process_response(send_query(sql_query)) transform_response(response_data[:result_data], response_data[:result_columns]) end |
#query(sql_query = nil) ⇒ Object
28 29 30 31 |
# File 'lib/data_conduit/adapters/trino_repository.rb', line 28 def query(sql_query = nil) sql_query ||= build_query execute(sql_query) end |