fastflowtransform.executors.bigquery.pandas¶
BigQueryExecutor ¶
Bases: BigQueryBaseExecutor[DataFrame]
Source code in src/fastflowtransform/executors/bigquery/pandas.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 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 | |
ENGINE_NAME
class-attribute
instance-attribute
¶
ENGINE_NAME = 'bigquery'
BigQuery executor (pandas DataFrames). ENV/Profiles typically use: - FF_BQ_PROJECT - FF_BQ_DATASET - FF_BQ_LOCATION (optional)
utest_read_relation ¶
utest_read_relation(relation)
Read a relation into a pandas DataFrame for unit-test assertions.
Source code in src/fastflowtransform/executors/bigquery/pandas.py
101 102 103 104 105 106 107 108 | |
utest_load_relation_from_rows ¶
utest_load_relation_from_rows(relation, rows)
Load rows into a BigQuery table for unit tests (replace if exists).
Source code in src/fastflowtransform/executors/bigquery/pandas.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
utest_clean_target ¶
utest_clean_target(relation)
For unit tests: drop any table/view with this name in the configured dataset.
Source code in src/fastflowtransform/executors/bigquery/pandas.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
run_sql ¶
run_sql(node, env)
Orchestrate SQL models
1) Render Jinja (ref/source/this) and strip leading {{ config(...) }}. 2) If the SQL is full DDL (CREATE …), execute it verbatim (passthrough). 3) Otherwise, normalize to CREATE OR REPLACE {TABLE|VIEW} AS
. The body is CTE-aware (keeps WITH … SELECT … intact).On failure, raise ModelExecutionError with a helpful snippet.
Source code in src/fastflowtransform/executors/base.py
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 | |
configure_query_budget_limit ¶
configure_query_budget_limit(limit)
Inject a configured per-query byte limit (e.g. from budgets.yml).
Source code in src/fastflowtransform/executors/base.py
501 502 503 504 505 506 507 508 509 510 511 512 513 | |
reset_node_stats ¶
reset_node_stats()
Reset per-node statistics buffer.
The run engine calls this before executing a model so that all
stats recorded via _record_query_stats(...) belong to that node.
Source code in src/fastflowtransform/executors/base.py
553 554 555 556 557 558 559 560 561 | |
get_node_stats ¶
get_node_stats()
Aggregate buffered QueryStats into a simple dict:
{
"bytes_scanned": <sum>,
"rows": <sum>,
"query_duration_ms": <sum>,
}
Called by the run engine after a node finishes.
Source code in src/fastflowtransform/executors/base.py
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 | |
run_python ¶
run_python(node)
Execute the Python model for a given node and materialize its result.
Source code in src/fastflowtransform/executors/base.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
execute_hook_sql ¶
execute_hook_sql(sql)
Execute one SQL statement for pre/post/on_run hooks.
Source code in src/fastflowtransform/executors/bigquery/base.py
331 332 333 334 335 | |
on_node_built ¶
on_node_built(node, relation, fingerprint)
Write/update dataset._ff_meta after a successful build. Both pandas + BigFrames executors use the logical engine key 'bigquery'.
Source code in src/fastflowtransform/executors/bigquery/base.py
195 196 197 198 199 200 201 | |
exists_relation ¶
exists_relation(relation)
Check presence in INFORMATION_SCHEMA for tables/views.
Source code in src/fastflowtransform/executors/bigquery/base.py
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 | |
create_table_as ¶
create_table_as(relation, select_sql)
CREATE TABLE AS with cleaned SELECT body (no trailing semicolons).
Source code in src/fastflowtransform/executors/bigquery/base.py
230 231 232 233 234 235 236 237 238 239 240 241 | |
incremental_insert ¶
incremental_insert(relation, select_sql)
INSERT INTO with cleaned SELECT body.
Source code in src/fastflowtransform/executors/bigquery/base.py
243 244 245 246 247 248 249 250 251 252 253 254 | |
incremental_merge ¶
incremental_merge(relation, select_sql, unique_key)
Portable fallback without native MERGE
- DELETE collisions via WHERE EXISTS against the cleaned SELECT body
- INSERT new rows from the same body
Source code in src/fastflowtransform/executors/bigquery/base.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
alter_table_sync_schema ¶
alter_table_sync_schema(relation, select_sql, *, mode='append_new_columns')
Best-effort additive schema sync
- infer select schema via LIMIT 0 query
- add missing columns as NULLABLE using inferred BigQuery types
Source code in src/fastflowtransform/executors/bigquery/base.py
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 | |
snapshot_prune ¶
snapshot_prune(relation, unique_key, keep_last, *, dry_run=False)
Delete older snapshot versions while keeping the most recent keep_last
rows per business key (including the current row).
Source code in src/fastflowtransform/executors/_snapshot_sql_mixin.py
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 | |