{/* Auto-generated by scripts/mdx_snippets_gen.py. Do not edit manually. */} export const PyVersioningCheckpointDelta = "table = db.create_table(\n \"checkpoint_delta_example\",\n [\n {\"id\": 1, \"author\": \"Richard\", \"quote\": \"Wubba Lubba Dub Dub!\"},\n {\"id\": 2, \"author\": \"Morty\", \"quote\": \"Rick, what's going on?\"},\n ],\n storage_options={\"new_table_enable_stable_row_ids\": \"true\"},\n mode=\"overwrite\",\n)\ntable.tags.create(\"baseline\", table.version)\ntable.add([{\"id\": 3, \"author\": \"Summer\", \"quote\": \"Whatever, Grandpa\"}])\ntable.update(where=\"id = 2\", values={\"quote\": \"Aww geez, Rick!\"})\ntable.delete(\"id = 1\")\n\ndelta = table.delta(\"baseline\")\nprint(\"inserted:\", delta.inserted_rows().read_all()[\"id\"].to_pylist())\nprint(\"updated:\", delta.updated_rows().read_all()[\"id\"].to_pylist())\nprint(\"deleted:\", delta.deleted_row_ids().read_all()[\"_rowid\"].to_pylist())\nprint(\n \"transactions:\",\n [transaction[\"operation\"] for transaction in delta.list_transactions()],\n)\n"; export const TsVersioningCheckpointDelta = "const table = await db.createTable(\n \"checkpoint_delta_example\",\n [\n { id: 1, author: \"Richard\", quote: \"Wubba Lubba Dub Dub!\" },\n { id: 2, author: \"Morty\", quote: \"Rick, what's going on?\" },\n ],\n {\n mode: \"overwrite\",\n storageOptions: { new_table_enable_stable_row_ids: \"true\" },\n },\n);\nconst tags = await table.tags();\nawait tags.create(\"baseline\", await table.version());\nawait table.add([\n { id: 3, author: \"Summer\", quote: \"Whatever, Grandpa\" },\n]);\nawait table.update({\n where: \"id = 2\",\n values: { quote: \"Aww geez, Rick!\" },\n});\nawait table.delete(\"id = 1\");\n\nconst delta = await table.delta(\"baseline\");\nconsole.log(delta.beginVersion, delta.endVersion);\n\nconst inserted = delta.insertedRows();\nconsole.log((await inserted.schema()).fields.map((field) => field.name));\nfor await (const batch of inserted) {\n console.log(\"inserted:\", batch.getChild(\"id\")?.toJSON());\n}\n\nconst updated = delta.updatedRows();\nfor await (const batch of updated) {\n console.log(\"updated:\", batch.getChild(\"id\")?.toJSON());\n}\n\nconst deleted = delta.deletedRowIds();\nfor await (const batch of deleted) {\n console.log(\"deleted row ids:\", batch.getChild(\"_rowid\")?.toJSON());\n}\n\nconsole.log(\n \"transactions:\",\n (await delta.listTransactions()).map(\n (transaction) => transaction.operation,\n ),\n);\n"; export const RsVersioningCheckpointDelta = "use futures::TryStreamExt;\n\nlet table = db\n .create_table(\n \"checkpoint_delta_example\",\n make_quotes_reader(vec![\n (1, \"Richard\", \"Wubba Lubba Dub Dub!\"),\n (2, \"Morty\", \"Rick, what's going on?\"),\n ]),\n )\n .storage_option(\"new_table_enable_stable_row_ids\", \"true\")\n .execute()\n .await?;\n\nlet mut tags = table.tags().await?;\ntags.create(\"baseline\", table.version().await?).await?;\ntable\n .add(make_quotes_reader(vec![(3, \"Summer\", \"Whatever, Grandpa\")]))\n .execute()\n .await?;\ntable\n .update()\n .only_if(\"id = 2\")\n .column(\"quote\", \"'Aww geez, Rick!'\")\n .execute()\n .await?;\ntable.delete(\"id = 1\").await?;\n\nlet delta = table.delta(\"baseline\", None).await?;\nlet mut inserted = delta.inserted_rows().await?;\nwhile let Some(batch) = inserted.try_next().await? {\n println!(\"inserted: {:?}\", batch.column_by_name(\"id\"));\n}\nlet mut deleted = delta.deleted_row_ids().await?;\nwhile let Some(batch) = deleted.try_next().await? {\n println!(\"deleted row ids: {batch:?}\");\n}\nfor transaction in delta.list_transactions().await? {\n println!(\"{}\", transaction.operation.name());\n}\n";