1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. 4 5 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class QueryDetails(object): 12 """ 13 All the information surrounding a query, including the query statement, 14 limits, consistency, and so forth. 15 """ 16 17 #: A constant which can be used with the consistency property of a QueryDetails. 18 #: This constant has a value of "EVENTUAL" 19 CONSISTENCY_EVENTUAL = "EVENTUAL" 20 21 #: A constant which can be used with the consistency property of a QueryDetails. 22 #: This constant has a value of "ABSOLUTE" 23 CONSISTENCY_ABSOLUTE = "ABSOLUTE" 24 25 def __init__(self, **kwargs): 26 """ 27 Initializes a new QueryDetails object with values from keyword arguments. 28 The following keyword arguments are supported (corresponding to the getters/setters of this class): 29 30 :param compartment_id: 31 The value to assign to the compartment_id property of this QueryDetails. 32 :type compartment_id: str 33 34 :param statement: 35 The value to assign to the statement property of this QueryDetails. 36 :type statement: str 37 38 :param is_prepared: 39 The value to assign to the is_prepared property of this QueryDetails. 40 :type is_prepared: bool 41 42 :param consistency: 43 The value to assign to the consistency property of this QueryDetails. 44 Allowed values for this property are: "EVENTUAL", "ABSOLUTE" 45 :type consistency: str 46 47 :param max_read_in_k_bs: 48 The value to assign to the max_read_in_k_bs property of this QueryDetails. 49 :type max_read_in_k_bs: int 50 51 :param variables: 52 The value to assign to the variables property of this QueryDetails. 53 :type variables: dict(str, object) 54 55 :param timeout_in_ms: 56 The value to assign to the timeout_in_ms property of this QueryDetails. 57 :type timeout_in_ms: int 58 59 """ 60 self.swagger_types = { 61 'compartment_id': 'str', 62 'statement': 'str', 63 'is_prepared': 'bool', 64 'consistency': 'str', 65 'max_read_in_k_bs': 'int', 66 'variables': 'dict(str, object)', 67 'timeout_in_ms': 'int' 68 } 69 70 self.attribute_map = { 71 'compartment_id': 'compartmentId', 72 'statement': 'statement', 73 'is_prepared': 'isPrepared', 74 'consistency': 'consistency', 75 'max_read_in_k_bs': 'maxReadInKBs', 76 'variables': 'variables', 77 'timeout_in_ms': 'timeoutInMs' 78 } 79 80 self._compartment_id = None 81 self._statement = None 82 self._is_prepared = None 83 self._consistency = None 84 self._max_read_in_k_bs = None 85 self._variables = None 86 self._timeout_in_ms = None 87 88 @property 89 def compartment_id(self): 90 """ 91 **[Required]** Gets the compartment_id of this QueryDetails. 92 Compartment OCID, to provide context for a table name in 93 the given statement. 94 95 96 :return: The compartment_id of this QueryDetails. 97 :rtype: str 98 """ 99 return self._compartment_id 100 101 @compartment_id.setter 102 def compartment_id(self, compartment_id): 103 """ 104 Sets the compartment_id of this QueryDetails. 105 Compartment OCID, to provide context for a table name in 106 the given statement. 107 108 109 :param compartment_id: The compartment_id of this QueryDetails. 110 :type: str 111 """ 112 self._compartment_id = compartment_id 113 114 @property 115 def statement(self): 116 """ 117 **[Required]** Gets the statement of this QueryDetails. 118 A NoSQL SQL query statement; or a Base64-encoded prepared statement. 119 120 121 :return: The statement of this QueryDetails. 122 :rtype: str 123 """ 124 return self._statement 125 126 @statement.setter 127 def statement(self, statement): 128 """ 129 Sets the statement of this QueryDetails. 130 A NoSQL SQL query statement; or a Base64-encoded prepared statement. 131 132 133 :param statement: The statement of this QueryDetails. 134 :type: str 135 """ 136 self._statement = statement 137 138 @property 139 def is_prepared(self): 140 """ 141 Gets the is_prepared of this QueryDetails. 142 If true, the statement is a prepared statement. 143 144 145 :return: The is_prepared of this QueryDetails. 146 :rtype: bool 147 """ 148 return self._is_prepared 149 150 @is_prepared.setter 151 def is_prepared(self, is_prepared): 152 """ 153 Sets the is_prepared of this QueryDetails. 154 If true, the statement is a prepared statement. 155 156 157 :param is_prepared: The is_prepared of this QueryDetails. 158 :type: bool 159 """ 160 self._is_prepared = is_prepared 161 162 @property 163 def consistency(self): 164 """ 165 Gets the consistency of this QueryDetails. 166 Consistency requirement for a read operation. 167 168 Allowed values for this property are: "EVENTUAL", "ABSOLUTE" 169 170 171 :return: The consistency of this QueryDetails. 172 :rtype: str 173 """ 174 return self._consistency 175 176 @consistency.setter 177 def consistency(self, consistency): 178 """ 179 Sets the consistency of this QueryDetails. 180 Consistency requirement for a read operation. 181 182 183 :param consistency: The consistency of this QueryDetails. 184 :type: str 185 """ 186 allowed_values = ["EVENTUAL", "ABSOLUTE"] 187 if not value_allowed_none_or_none_sentinel(consistency, allowed_values): 188 raise ValueError( 189 "Invalid value for `consistency`, must be None or one of {0}" 190 .format(allowed_values) 191 ) 192 self._consistency = consistency 193 194 @property 195 def max_read_in_k_bs(self): 196 """ 197 Gets the max_read_in_k_bs of this QueryDetails. 198 A limit on the total amount of data read during this operation, in KB. 199 200 201 :return: The max_read_in_k_bs of this QueryDetails. 202 :rtype: int 203 """ 204 return self._max_read_in_k_bs 205 206 @max_read_in_k_bs.setter 207 def max_read_in_k_bs(self, max_read_in_k_bs): 208 """ 209 Sets the max_read_in_k_bs of this QueryDetails. 210 A limit on the total amount of data read during this operation, in KB. 211 212 213 :param max_read_in_k_bs: The max_read_in_k_bs of this QueryDetails. 214 :type: int 215 """ 216 self._max_read_in_k_bs = max_read_in_k_bs 217 218 @property 219 def variables(self): 220 """ 221 Gets the variables of this QueryDetails. 222 A map of prepared statement variables to values. 223 224 225 :return: The variables of this QueryDetails. 226 :rtype: dict(str, object) 227 """ 228 return self._variables 229 230 @variables.setter 231 def variables(self, variables): 232 """ 233 Sets the variables of this QueryDetails. 234 A map of prepared statement variables to values. 235 236 237 :param variables: The variables of this QueryDetails. 238 :type: dict(str, object) 239 """ 240 self._variables = variables 241 242 @property 243 def timeout_in_ms(self): 244 """ 245 Gets the timeout_in_ms of this QueryDetails. 246 Timeout setting for the query. 247 248 249 :return: The timeout_in_ms of this QueryDetails. 250 :rtype: int 251 """ 252 return self._timeout_in_ms 253 254 @timeout_in_ms.setter 255 def timeout_in_ms(self, timeout_in_ms): 256 """ 257 Sets the timeout_in_ms of this QueryDetails. 258 Timeout setting for the query. 259 260 261 :param timeout_in_ms: The timeout_in_ms of this QueryDetails. 262 :type: int 263 """ 264 self._timeout_in_ms = timeout_in_ms 265 266 def __repr__(self): 267 return formatted_flat_dict(self) 268 269 def __eq__(self, other): 270 if other is None: 271 return False 272 273 return self.__dict__ == other.__dict__ 274 275 def __ne__(self, other): 276 return not self == other 277