{/* Auto-generated by scripts/mdx_snippets_gen.py. Do not edit manually. */} export const PyGroupedTrainingTakes = "def take_training_batches(table, version, offset_batches, columns):\n from itertools import islice\n\n table.checkout(version)\n offset_batches = iter(offset_batches)\n while group := list(islice(offset_batches, 4)):\n batch_sizes = [len(batch) for batch in group]\n if sum(batch_sizes) > 1024:\n raise ValueError(\"A grouped take can request at most 1,024 rows\")\n\n offsets = [offset for batch in group for offset in batch]\n rows = (\n table.take_offsets(offsets, preserve_order=True).select(columns).to_arrow()\n )\n if rows.num_rows != len(offsets):\n raise ValueError(\"Some training offsets are missing from the snapshot\")\n\n start = 0\n for size in batch_sizes:\n yield rows.slice(start, size)\n start += size\n"; export const PySampleDataset = "table = db.create_table(\"records\", [{\"id\": i} for i in range(10)])\nsplits = (\n permutation_builder(table).split_random(counts=[3, 7], seed=42).execute()\n)\nsample = Permutation.from_tables(table, splits, split=0).with_format(\"arrow\")\nselected_ids = []\nfor batch in sample.iter(batch_size=3):\n selected_ids.extend(batch.column(\"id\").to_pylist())\nprint(f\"Selected {len(selected_ids)} rows: {selected_ids}\")\n";