Queries
Query
scylla_bridge.query.Query
Bases: ABC
Generic query expression.
build_query
abstractmethod
build_query()
Builds the query into a string and its parameters as a list.
Returns:
| Type | Description |
|---|---|
Tuple[str, List[Any]]
|
The query string and the corresponding parameters. |
Source code in scylla_bridge/query.py
37 38 39 40 41 42 43 44 45 46 | |
execute
async
execute(scylla_instance)
Executes the query using a Scylla instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scylla_instance
|
Scylla
|
The Scylla instance used to execute the query. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of the executed query. |
Source code in scylla_bridge/query.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
Select
scylla_bridge.query.Select
Select(*columns)
Bases: Query
Select query from Scylla.
Initializes the Select query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*columns
|
Column or AggregateExpr or Type[Table]
|
The columns to be selected in the query. |
()
|
Source code in scylla_bridge/query.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
allow_filtering
allow_filtering()
Enables the 'ALLOW FILTERING' option in the query.
Returns:
| Type | Description |
|---|---|
Select
|
The updated Select query with 'ALLOW FILTERING' enabled. |
Source code in scylla_bridge/query.py
107 108 109 110 111 112 113 114 115 116 117 118 119 | |
build_query
build_query()
Builds the SELECT query into a string and its parameters.
Returns:
| Type | Description |
|---|---|
Tuple[str, List[Any]]
|
The query string and the corresponding parameters. |
Source code in scylla_bridge/query.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
distinct
distinct()
Enables the DISTINCT option in the query.
Returns:
| Type | Description |
|---|---|
Select
|
The updated Select query with DISTINCT enabled. |
Source code in scylla_bridge/query.py
188 189 190 191 192 193 194 195 196 197 | |
execute
async
execute(scylla_instance)
Executes the query using a Scylla instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scylla_instance
|
Scylla
|
The Scylla instance used to execute the query. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of the executed query. |
Source code in scylla_bridge/query.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
group_by
group_by(*columns)
Adds GROUP BY conditions to the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*columns
|
Column
|
The columns to group by in the query. |
()
|
Returns:
| Type | Description |
|---|---|
Select
|
The updated Select query with GROUP BY conditions. |
Source code in scylla_bridge/query.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
limit
limit(_limit)
Sets a limit on the number of rows returned by the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_limit
|
int
|
The maximum number of rows to return. |
required |
Returns:
| Type | Description |
|---|---|
Select
|
The updated Select query with a limit. |
Source code in scylla_bridge/query.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
where
where(*predicates)
Adds WHERE conditions to the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*predicates
|
ColumnExpr
|
The column expressions to be used in the WHERE clause. |
()
|
Returns:
| Type | Description |
|---|---|
Select
|
The updated Select query with WHERE conditions. |
Source code in scylla_bridge/query.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
Update
scylla_bridge.query.Update
Update(table)
Bases: Query
Update query.
Initializes the Update query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Type[Table]
|
The table to be updated. |
required |
Source code in scylla_bridge/query.py
227 228 229 230 231 232 233 234 235 236 237 238 239 | |
build_query
build_query()
Builds the UPDATE query into a string and its parameters.
Returns:
| Type | Description |
|---|---|
Tuple[str, List[Any]]
|
The query string and the corresponding parameters. |
Source code in scylla_bridge/query.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
execute
async
execute(scylla_instance)
Executes the query using a Scylla instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scylla_instance
|
Scylla
|
The Scylla instance used to execute the query. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of the executed query. |
Source code in scylla_bridge/query.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
set
set(column, value)
Sets the values to be updated in the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
Column
|
The column to update. |
required |
value
|
Any
|
The new value for the column. |
required |
Returns:
| Type | Description |
|---|---|
Update
|
The updated Update query with the new SET values. |
Source code in scylla_bridge/query.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
where
where(*predicates)
Adds WHERE conditions to the update query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*predicates
|
ColumnExpr
|
The column expressions to be used in the WHERE clause. |
()
|
Returns:
| Type | Description |
|---|---|
Update
|
The updated Update query with WHERE conditions. |
Source code in scylla_bridge/query.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
Delete
scylla_bridge.query.Delete
Delete(table)
Bases: Query
Delete query.
Initializes the Delete query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Type[Table]
|
The table from which records are to be deleted. |
required |
Source code in scylla_bridge/query.py
319 320 321 322 323 324 325 326 327 328 329 330 331 | |
build_query
build_query()
Builds the DELETE query into a string and its parameters.
Returns:
| Type | Description |
|---|---|
Tuple[str, List[Any]]
|
The query string and the corresponding parameters. |
Source code in scylla_bridge/query.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
execute
async
execute(scylla_instance)
Executes the query using a Scylla instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scylla_instance
|
Scylla
|
The Scylla instance used to execute the query. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of the executed query. |
Source code in scylla_bridge/query.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
if_exists
if_exists()
Adds the IF EXISTS clause to the query.
Returns:
| Type | Description |
|---|---|
Delete
|
The updated Delete query with IF EXISTS enabled. |
Source code in scylla_bridge/query.py
333 334 335 336 337 338 339 340 341 342 | |
where
where(*predicates)
Adds WHERE conditions to the delete query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*predicates
|
ColumnExpr
|
The column expressions to be used in the WHERE clause. |
()
|
Returns:
| Type | Description |
|---|---|
Delete
|
The updated Delete query with WHERE conditions. |
Source code in scylla_bridge/query.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
Insert
scylla_bridge.query.Insert
Insert(table)
Bases: Query
Insert query.
Suboptimal way to insert, as the "best way" is to batch insert using directly scyllaft.
Initializes the Insert query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Type[Table]
|
The table into which records are to be inserted. |
required |
Source code in scylla_bridge/query.py
396 397 398 399 400 401 402 403 404 405 406 407 | |
build_query
build_query()
Builds the DELETE query into a string and its parameters.
Returns:
| Type | Description |
|---|---|
Tuple[str, List[Any]]
|
The query string and the corresponding parameters. |
Source code in scylla_bridge/query.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
execute
async
execute(scylla_instance)
Executes the query using a Scylla instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scylla_instance
|
Scylla
|
The Scylla instance used to execute the query. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The result of the executed query. |
Source code in scylla_bridge/query.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
values
values(*values)
Specifies the values to be inserted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Table
|
The values to be inserted into the table. |
()
|
Returns:
| Type | Description |
|---|---|
Insert
|
The updated Insert query with values. |
Source code in scylla_bridge/query.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |