{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0abab29a-c250-4e79-b30b-5c59c972a9ac",
   "metadata": {},
   "source": [
    "## Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8251aab-3918-4b8f-9b59-360a8a0e4803",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pushd .; cd ../../; poetry install --no-dev; popd"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf7d2f76-919c-4e45-96a7-e92d12288c70",
   "metadata": {},
   "source": [
    "# Run the Tutorials"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "981f3349-6171-4471-aa7e-7c7d081a2bdb",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python 0_hello_dataset_flow.py run"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab81a300-04a7-4b2b-9acc-bbe128b1cdbc",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python 1_input_output_flow.py run"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f20b4c12-f036-446c-9f86-64558e692c8a",
   "metadata": {},
   "source": [
    "# The Consistent Flow!"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af42c2d4-8b60-4b68-b6f6-488f0ea5bada",
   "metadata": {},
   "source": [
    "### Default Context is BATCH"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "faec4f91-c21e-44a3-9fe3-2de184a81886",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python 5_consistent_flow.py --no-pylint run"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1d18870-81bd-4087-9b3d-d31551deac1c",
   "metadata": {},
   "source": [
    "### Try it with ONLINE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "995b046c-eda7-40d5-a7b5-a25a484cc137",
   "metadata": {},
   "outputs": [],
   "source": [
    "!CONTEXT=ONLINE python 5_consistent_flow.py --no-pylint run"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c2d3a00b-ddcf-440e-a11a-913d159c8a07",
   "metadata": {},
   "source": [
    "## Try parameterized Dataset with columns=\"value\"\n",
    "### note: default is CONTEXT=BATCH"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3bf63c5b-5b0b-417d-bbcf-1af36b337f20",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Try parameterized Dataset with columns=\"value\"\n",
    "# note: default is CONTEXT=BATCH\n",
    "!python 5_consistent_flow.py --no-pylint run --hello_ds '{\"name\": \"HelloDs\", \"mode\": \"READ_WRITE\", \"columns\": \"value\"}'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54e263a7-def1-4a32-9815-798ff05ed6de",
   "metadata": {},
   "source": [
    "### Try it with ONLINE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d907fe1c-72c3-455d-8616-455983e7daaa",
   "metadata": {},
   "outputs": [],
   "source": [
    "!CONTEXT=ONLINE python 5_consistent_flow.py --no-pylint run --hello_ds '{\"name\": \"HelloDs\", \"mode\": \"READ_WRITE\", \"columns\": \"value\"}'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5d9388c8-fdf6-403a-a887-0372f42ad4b4",
   "metadata": {},
   "source": [
    "## Bind to certain keys: only works in ONLINE context\n",
    "### Notice how it binds to only returns only `key=secret`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c166e36c-290a-4831-9bf8-82207a65403b",
   "metadata": {},
   "outputs": [],
   "source": [
    "!CONTEXT=ONLINE python 5_consistent_flow.py --no-pylint run --hello_ds '{\"name\": \"HelloDs\", \"mode\": \"READ_WRITE\", \"columns\": \"value\"}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8744fea1-3af1-4525-b2d7-cb6b9e44b7cb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
