Core Reference
graphique.core.ListChunk
Bases: BaseListArray
Source code in graphique/core.py
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
aggregate(**funcs)
Return aggregated scalars by grouping each hash function on the parent indices.
If there are empty or null scalars, then the result must be padded with null defaults and
reordered. If the function is a count
, then the default is 0.
Source code in graphique/core.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
element(index)
element at index of each list scalar; defaults to null
Source code in graphique/core.py
122 123 124 125 126 127 128 129 130 131 |
|
first()
first value of each list scalar
Source code in graphique/core.py
133 134 135 |
|
from_counts(counts, values)
Return list array by converting counts into offsets.
Source code in graphique/core.py
109 110 111 112 113 114 115 116 |
|
from_scalars(values)
Return list array from array scalars.
Source code in graphique/core.py
118 119 120 |
|
index(**options)
index for first occurrence of each list scalar
Source code in graphique/core.py
200 201 202 |
|
inner_flatten()
Return flattened inner lists from a nested list array.
Source code in graphique/core.py
150 151 152 153 |
|
last()
last value of each list scalar
Source code in graphique/core.py
137 138 139 |
|
list_all(ctx, self)
Test whether all elements in a boolean array evaluate to true.
Source code in graphique/core.py
204 205 206 207 |
|
list_any(ctx, self)
Test whether any element in a boolean array evaluates to true.
Source code in graphique/core.py
209 210 211 212 |
|
map_list(func, **kwargs)
Return list array by mapping function across scalars, with null handling.
Source code in graphique/core.py
145 146 147 148 |
|
max(**options)
max value of each list scalar
Source code in graphique/core.py
188 189 190 |
|
min(**options)
min value of each list scalar
Source code in graphique/core.py
184 185 186 |
|
mode(**options)
modes of each list scalar
Source code in graphique/core.py
192 193 194 |
|
quantile(**options)
quantiles of each list scalar
Source code in graphique/core.py
196 197 198 |
|
graphique.core.Column
Bases: ChunkedArray
Chunked array interface as a namespace of functions.
Source code in graphique/core.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
diff(func=pc.subtract, period=1)
Compute first order difference of an array.
Unlike pairwise_diff
, does not return leading nulls.
Source code in graphique/core.py
250 251 252 253 254 255 |
|
fill_null(value)
Optimized fill_null
to check null_count
.
Source code in graphique/core.py
236 237 238 |
|
fill_null_backward()
fill_null_backward
with dictionary support.
Source code in graphique/core.py
228 229 230 |
|
fill_null_forward()
fill_null_forward
with dictionary support.
Source code in graphique/core.py
232 233 234 |
|
find(*values)
Generate slices of matching rows from a sorted array.
Source code in graphique/core.py
290 291 292 293 294 295 296 |
|
index(value, start=0, end=None)
Return the first index of a value.
Source code in graphique/core.py
268 269 270 271 272 273 274 275 276 277 278 279 280 |
|
pairwise_diff(period=1)
pairwise_diff
with chunked array support.
Source code in graphique/core.py
246 247 248 |
|
range(lower=None, upper=None, include_lower=True, include_upper=False)
Return slice within range from a sorted array, by default a half-open interval.
Source code in graphique/core.py
282 283 284 285 286 287 288 |
|
run_offsets(predicate=pc.not_equal, *args)
Run-end encode array with leading zero, suitable for list offsets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predicate
|
Callable
|
binary function applied to adjacent values |
not_equal
|
*args
|
apply binary function to scalar, using |
()
|
Source code in graphique/core.py
257 258 259 260 261 262 263 264 265 266 |
|
graphique.core.Table
Bases: Table
Table interface as a namespace of functions.
Source code in graphique/core.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
columns()
Return columns as a dictionary.
Source code in graphique/core.py
305 306 307 |
|
filter_list(expr)
Return table with list columns filtered within scalars.
Source code in graphique/core.py
428 429 430 431 432 433 434 435 436 437 |
|
flatten(indices='')
Generate batches with list arrays flattened, optionally with parent indices.
Source code in graphique/core.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
|
fragments(*names, counts='')
Return selected fragment keys in a table.
Source code in graphique/core.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
|
from_counts(counts)
Return record batch with columns converted into list columns.
Source code in graphique/core.py
347 348 349 350 351 352 353 |
|
from_offsets(offsets, mask=None)
Return record batch with columns converted into list columns.
Source code in graphique/core.py
339 340 341 342 343 344 345 |
|
is_in(name, *values)
Return rows which matches one of the values.
Assumes the table is sorted by the column name, i.e., indexed.
Source code in graphique/core.py
323 324 325 326 327 328 329 |
|
map_list(func, *args, **kwargs)
Return table with function mapped across list scalars.
Source code in graphique/core.py
385 386 387 388 389 390 391 |
|
min_max(*names)
Return table filtered by minimum or maximum values.
Source code in graphique/core.py
439 440 441 442 443 444 445 |
|
not_equal(name, value)
Return rows which don't match the value.
Assumes the table is sorted by the column name, i.e., indexed.
Source code in graphique/core.py
331 332 333 334 335 336 337 |
|
range(name, lower=None, upper=None, **includes)
Return rows within range, by default a half-open interval.
Assumes the table is sorted by the column name, i.e., indexed.
Source code in graphique/core.py
316 317 318 319 320 321 |
|
rank(k, *names)
Return table filtered by values within dense rank, similar to select_k_unstable
.
Source code in graphique/core.py
447 448 449 450 451 452 453 454 455 456 457 458 |
|
rank_keys(k, *names, dense=True)
Return expression and unmatched fields for partitioned dataset which filters by rank.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k
|
int
|
max dense rank or length |
required |
*names
|
str
|
columns to rank by |
()
|
dense
|
bool
|
use dense rank; false indicates sorting |
True
|
Source code in graphique/core.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
|
runs(*names, **predicates)
Return table grouped by pairwise differences, and corresponding counts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*names
|
str
|
columns to partition by |
()
|
**predicates
|
tuple
|
pairwise predicates with optional args which will return list arrays; if the predicate has args, it will be called on the differences |
{}
|
Source code in graphique/core.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
size()
Return buffer size in readable units.
Source code in graphique/core.py
536 537 538 539 540 541 |
|
sort(*names, length=None, indices='', null_placement='at_end')
Return table sorted by columns, optimized for fixed length.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*names
|
str
|
columns to sort by |
()
|
length
|
Optional[int]
|
maximum number of rows to return |
None
|
indices
|
str
|
include original indices in the table |
''
|
Source code in graphique/core.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
|
sort_indices(*names, length=None, null_placement='at_end')
Return indices which would sort the table by columns, optimized for fixed length.
Source code in graphique/core.py
393 394 395 396 397 398 399 400 401 402 |
|
split()
Generate tables from splitting list scalars.
Source code in graphique/core.py
524 525 526 527 528 529 530 531 532 533 534 |
|
union(*tables)
Return table with union of columns.
Source code in graphique/core.py
309 310 311 312 313 314 |
|
graphique.core.Nodes
Bases: Declaration
Acero engine declaration.
Provides a Scanner
interface with no "oneshot" limitation.
Source code in graphique/core.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
|
schema: pa.Schema
property
projected schema
apply(name, *args, **options)
Add a node by name.
Source code in graphique/core.py
600 601 602 |
|
count_rows()
Count matching rows.
Source code in graphique/core.py
588 589 590 |
|
group(*names, **aggs)
Add aggregate
node with dictionary support.
Also supports datasets because aggregation determines the projection.
Source code in graphique/core.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
|
head(num_rows, **options)
Load the first N rows.
Source code in graphique/core.py
592 593 594 |
|
scan(columns)
Return projected source node, supporting datasets and tables.
Source code in graphique/core.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
|
take(indices, **options)
Select rows by index.
Source code in graphique/core.py
596 597 598 |
|
graphique.interface.Dataset
Source code in graphique/interface.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 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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
add_metric(info, table, **data)
staticmethod
Add memory usage and other metrics to context with path info.
Source code in graphique/interface.py
173 174 175 176 177 178 |
|
aggregate(info, approximate_median=[], count=[], count_distinct=[], distinct=[], first=[], last=[], max=[], mean=[], min=[], product=[], stddev=[], sum=[], tdigest=[], variance=[])
Return table with scalar aggregate functions applied to list columns.
Source code in graphique/interface.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
|
any(info, length=1)
Return whether there are at least length
rows.
May be significantly faster than length
for out-of-core data.
Source code in graphique/interface.py
185 186 187 188 189 190 191 192 |
|
apply(info, cumulative_max=[], cumulative_mean=[], cumulative_min=[], cumulative_prod=[], cumulative_sum=[], fill_null_backward=[], fill_null_forward=[], pairwise_diff=[], rank=[], list_={})
Return view of table with vector functions applied across columns.
Applied functions load arrays into memory as needed. See scan
for scalar functions,
which do not require loading.
Source code in graphique/interface.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
column(info, name, cast='', safe=True)
Return column of any type by name.
This is typically only needed for aliased or casted columns.
If the column is in the schema, columns
can be used instead.
Source code in graphique/interface.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
columns(info)
fields for each column
Source code in graphique/interface.py
103 104 105 106 |
|
drop_null(info)
Remove missing values from referenced columns in the table.
Source code in graphique/interface.py
510 511 512 513 514 515 516 |
|
filter(info, **queries)
Return table with rows which match all queries.
See scan(filter: ...)
for more advanced queries. Additional feature: sorted tables
support binary search
Source code in graphique/interface.py
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 |
|
flatten(info, indices='')
Return table with list arrays flattened.
At least one list column must be referenced, and all list columns must have the same lengths.
Source code in graphique/interface.py
389 390 391 392 393 394 395 396 |
|
group(info, by=[], counts='', ordered=False, aggregate={})
Return table grouped by columns.
See column
for accessing any column which has changed type. See tables
to split on any
aggregated list columns.
Source code in graphique/interface.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|
join(info, right, keys, right_keys=None, join_type='left outer', left_suffix='', right_suffix='', coalesce_keys=True)
Provisional: join this table with another table on the root Query type.
Source code in graphique/interface.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
length()
number of rows
Source code in graphique/interface.py
180 181 182 183 |
|
optional()
Nullable field to stop error propagation, enabling partial query results.
Will be replaced by client controlled nullability.
Source code in graphique/interface.py
165 166 167 168 169 170 171 |
|
rank(info, by, max=1)
Return table selected by maximum dense rank.
Source code in graphique/interface.py
325 326 327 328 329 330 331 332 333 334 335 |
|
references(info, level=0)
Return set of every possible future column reference.
Source code in graphique/interface.py
67 68 69 70 71 72 |
|
resolve_reference(info, **keys)
classmethod
Return table from federated keys.
Source code in graphique/interface.py
95 96 97 98 99 100 101 |
|
row(info, index=0)
Return scalar values at index.
Source code in graphique/interface.py
108 109 110 111 112 113 114 115 116 |
|
runs(info, by=[], split=[], counts='')
Return table grouped by pairwise differences.
Differs from group
by relying on adjacency, and is typically faster. Other columns are
transformed into list columns. See column
and tables
to further access lists.
Source code in graphique/interface.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
scan(info, filter={}, columns=[])
Select rows and project columns without memory usage.
Source code in graphique/interface.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
schema()
dataset schema
Source code in graphique/interface.py
151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
select(info)
Return source with only the columns necessary to proceed.
Source code in graphique/interface.py
74 75 76 77 78 79 80 81 82 83 84 |
|
size()
buffer size in bytes; null if table is not loaded
Source code in graphique/interface.py
194 195 196 197 |
|
slice(info, offset=0, length=None, reverse=False)
Return zero-copy slice of table.
Can also be sued to force loading a dataset.
Source code in graphique/interface.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
sort(info, by, length=None, null_placement='at_end')
Return table slice sorted by specified columns.
Optimized for length == 1; matches min or max values.
Source code in graphique/interface.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
tables(info)
Return a list of tables by splitting list columns.
At least one list column must be referenced, and all list columns must have the same lengths.
Source code in graphique/interface.py
398 399 400 401 402 403 404 405 406 |
|
take(info, indices)
Select rows from indices.
Source code in graphique/interface.py
504 505 506 507 508 |
|
to_table(info, length=None)
Return table with only the rows and columns necessary to proceed.
Source code in graphique/interface.py
86 87 88 89 90 91 92 93 |
|
type()
Source code in graphique/interface.py
146 147 148 149 |
|
graphique.middleware.GraphQL
Bases: GraphQL
ASGI GraphQL app with root value(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root
|
Source
|
root dataset to attach as the Query type |
required |
debug
|
bool
|
enable timing extension |
False
|
**kwargs
|
additional |
{}
|
Source code in graphique/middleware.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
federated(roots, keys={}, **kwargs)
classmethod
Construct GraphQL app with multiple federated datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
roots
|
Mapping[str, Source]
|
mapping of field names to root datasets |
required |
keys
|
Mapping[str, Iterable]
|
mapping of optional federation keys for each root |
{}
|
**kwargs
|
additional |
{}
|
Source code in graphique/middleware.py
65 66 67 68 69 70 71 72 73 74 75 76 77 |
|