diff --git a/dmedvedev/python/15.functions.ipynb b/dmedvedev/python/15.functions.ipynb index 34e0210..a7bb261 100644 --- a/dmedvedev/python/15.functions.ipynb +++ b/dmedvedev/python/15.functions.ipynb @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "ad2441e7", "metadata": {}, "outputs": [ @@ -156,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "id": "d3c6683e", "metadata": {}, "outputs": [ @@ -172,11 +172,11 @@ ], "source": [ "def build_mart_name(entity_name, layer):\n", - " print(f\"{layer}_{entity_name}\")\n", + " return f\"{layer}_{entity_name}\"\n", "\n", - "build_mart_name(\"orders\", \"dm\")\n", - "build_mart_name(\"users\", \"core\")\n", - "build_mart_name(\"payments\", \"stg\")" + "print(build_mart_name(\"orders\", \"dm\"))\n", + "print(build_mart_name(\"users\", \"core\"))\n", + "print(build_mart_name(\"payments\", \"stg\"))" ] } ], diff --git a/dmedvedev/python/16.varuables_on_default.ipynb b/dmedvedev/python/16.varuables_on_default.ipynb index dd8f6c9..6a8c698 100644 --- a/dmedvedev/python/16.varuables_on_default.ipynb +++ b/dmedvedev/python/16.varuables_on_default.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 59, "id": "2af8c0ea", "metadata": {}, "outputs": [ @@ -30,9 +30,9 @@ ], "source": [ "def log_job_start(job_name, level = \"INFO\", env = \"dev\"):\n", - " print(f\"[{level}] {job_name} load_users started in {env}\")\n", + " print(f\"[{level}] Job {job_name} started in {env}\")\n", "\n", - "log_job_start(\"Job\")" + "log_job_start(\"load_users\")" ] }, { @@ -138,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 94, "id": "ceb7c30b", "metadata": {}, "outputs": [ @@ -148,7 +148,7 @@ "'Row is valid'" ] }, - "execution_count": 55, + "execution_count": 94, "metadata": {}, "output_type": "execute_result" } @@ -158,10 +158,11 @@ " if required_fields is None:\n", " required_fields = [\"id\"]\n", " for field in required_fields:\n", - " if field not in required_fields:\n", + " if field not in row:\n", " return f\"Missing field: {field}\"\n", - " else:\n", - " return \"Row is valid\"" + " return \"Row is valid\"\n", + "\n", + "validate_row({\"id\": 1, \"email\":2}, [\"id\", \"email\"])" ] } ],