Class: OCI::Opsi::Models::DataObjectTemplatizedQuery

Inherits:
DataObjectQuery show all
Defined in:
lib/oci/opsi/models/data_object_templatized_query.rb

Overview

Information required in a structured template to form and execute query on a data object.

Constant Summary

Constants inherited from DataObjectQuery

OCI::Opsi::Models::DataObjectQuery::QUERY_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from DataObjectQuery

#bind_params, #query_execution_timeout_in_seconds, #query_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataObjectQuery

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ DataObjectTemplatizedQuery

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 98

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['queryType'] = 'TEMPLATIZED_QUERY'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.select_list = attributes[:'selectList'] if attributes[:'selectList']

  raise 'You cannot provide both :selectList and :select_list' if attributes.key?(:'selectList') && attributes.key?(:'select_list')

  self.select_list = attributes[:'select_list'] if attributes[:'select_list']

  self.from_clause = attributes[:'fromClause'] if attributes[:'fromClause']

  raise 'You cannot provide both :fromClause and :from_clause' if attributes.key?(:'fromClause') && attributes.key?(:'from_clause')

  self.from_clause = attributes[:'from_clause'] if attributes[:'from_clause']

  self.where_conditions_list = attributes[:'whereConditionsList'] if attributes[:'whereConditionsList']

  raise 'You cannot provide both :whereConditionsList and :where_conditions_list' if attributes.key?(:'whereConditionsList') && attributes.key?(:'where_conditions_list')

  self.where_conditions_list = attributes[:'where_conditions_list'] if attributes[:'where_conditions_list']

  self.group_by_list = attributes[:'groupByList'] if attributes[:'groupByList']

  raise 'You cannot provide both :groupByList and :group_by_list' if attributes.key?(:'groupByList') && attributes.key?(:'group_by_list')

  self.group_by_list = attributes[:'group_by_list'] if attributes[:'group_by_list']

  self.having_conditions_list = attributes[:'havingConditionsList'] if attributes[:'havingConditionsList']

  raise 'You cannot provide both :havingConditionsList and :having_conditions_list' if attributes.key?(:'havingConditionsList') && attributes.key?(:'having_conditions_list')

  self.having_conditions_list = attributes[:'having_conditions_list'] if attributes[:'having_conditions_list']

  self.order_by_list = attributes[:'orderByList'] if attributes[:'orderByList']

  raise 'You cannot provide both :orderByList and :order_by_list' if attributes.key?(:'orderByList') && attributes.key?(:'order_by_list')

  self.order_by_list = attributes[:'order_by_list'] if attributes[:'order_by_list']

  self.time_filters = attributes[:'timeFilters'] if attributes[:'timeFilters']

  raise 'You cannot provide both :timeFilters and :time_filters' if attributes.key?(:'timeFilters') && attributes.key?(:'time_filters')

  self.time_filters = attributes[:'time_filters'] if attributes[:'time_filters']
end

Instance Attribute Details

#from_clauseString

Unique data object name that will be added into the FROM clause of the query, just like a view name in FROM clause. - Use actual name of the data objects (e.g: tables, views) in case of Warehouse (e.g: Awr hub) data objects query. SCHEMA.VIEW name syntax can also be used here. e.g: SYS.DBA_HIST_SNAPSHOT or DBA_HIST_SNAPSHOT - Use name of the data object (e.g: SQL_STATS_DO) in case of OPSI data objects. Identifier of the OPSI data object cannot be used here.

Returns:

  • (String)


22
23
24
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 22

def from_clause
  @from_clause
end

#group_by_listArray<String>

List of items to be added into the GROUP BY clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


34
35
36
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 34

def group_by_list
  @group_by_list
end

#having_conditions_listArray<String>

List of items to be added into the HAVING clause of the query; items will be added with AND separation.

Returns:

  • (Array<String>)


38
39
40
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 38

def having_conditions_list
  @having_conditions_list
end

#order_by_listArray<String>

List of items to be added into the ORDER BY clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


42
43
44
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 42

def order_by_list
  @order_by_list
end

#select_listArray<String>

List of items to be added into the SELECT clause of the query; items will be added with comma separation.

Returns:

  • (Array<String>)


14
15
16
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 14

def select_list
  @select_list
end

#time_filtersOCI::Opsi::Models::DataObjectQueryTimeFilters



45
46
47
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 45

def time_filters
  @time_filters
end

#where_conditions_listArray<String>

List of items to be added into the WHERE clause of the query; items will be added with AND separation. Item can contain a single condition or multiple conditions. Single condition e.g: "optimizer_mode='mode1'" Multiple conditions e.g: (module='module1' OR module='module2')

Returns:

  • (Array<String>)


30
31
32
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 30

def where_conditions_list
  @where_conditions_list
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'queryType',
    'bind_params': :'bindParams',
    'query_execution_timeout_in_seconds': :'queryExecutionTimeoutInSeconds',
    'select_list': :'selectList',
    'from_clause': :'fromClause',
    'where_conditions_list': :'whereConditionsList',
    'group_by_list': :'groupByList',
    'having_conditions_list': :'havingConditionsList',
    'order_by_list': :'orderByList',
    'time_filters': :'timeFilters'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 66

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'query_type': :'String',
    'bind_params': :'Array<OCI::Opsi::Models::DataObjectBindParameter>',
    'query_execution_timeout_in_seconds': :'Float',
    'select_list': :'Array<String>',
    'from_clause': :'String',
    'where_conditions_list': :'Array<String>',
    'group_by_list': :'Array<String>',
    'having_conditions_list': :'Array<String>',
    'order_by_list': :'Array<String>',
    'time_filters': :'OCI::Opsi::Models::DataObjectQueryTimeFilters'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 158

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    query_type == other.query_type &&
    bind_params == other.bind_params &&
    query_execution_timeout_in_seconds == other.query_execution_timeout_in_seconds &&
    select_list == other.select_list &&
    from_clause == other.from_clause &&
    where_conditions_list == other.where_conditions_list &&
    group_by_list == other.group_by_list &&
    having_conditions_list == other.having_conditions_list &&
    order_by_list == other.order_by_list &&
    time_filters == other.time_filters
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 197

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


177
178
179
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 177

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



186
187
188
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 186

def hash
  [query_type, bind_params, query_execution_timeout_in_seconds, select_list, from_clause, where_conditions_list, group_by_list, having_conditions_list, order_by_list, time_filters].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 230

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



224
225
226
# File 'lib/oci/opsi/models/data_object_templatized_query.rb', line 224

def to_s
  to_hash.to_s
end