From c2ef9446774525753e7c5a8329513bc62a5111c0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 21:39:57 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../01-authoring_expectation_suites.ipynb | 32 ++++++++++++++----- ...lidation-definitions-and-checkpoints.ipynb | 26 +++++++++------ .../notebooks/03-sql_month_and_year.ipynb | 23 +++++++++---- .../01-authoring_expectation_suites.ipynb | 32 ++++++++++++++----- ...lidation-definitions-and-checkpoints.ipynb | 26 +++++++++------ .../notebooks/03-sql_month_and_year.ipynb | 23 +++++++++---- 6 files changed, 114 insertions(+), 48 deletions(-) diff --git a/gx-1.0.0a2/demos/notebooks/01-authoring_expectation_suites.ipynb b/gx-1.0.0a2/demos/notebooks/01-authoring_expectation_suites.ipynb index fd86a48..91e8ae0 100644 --- a/gx-1.0.0a2/demos/notebooks/01-authoring_expectation_suites.ipynb +++ b/gx-1.0.0a2/demos/notebooks/01-authoring_expectation_suites.ipynb @@ -67,10 +67,14 @@ "context = gx.get_context(mode=\"file\")\n", "\n", "try:\n", - " datasource = context.sources.add_postgres(DATASOURCE_NAME, connection_string=DB_CONNECTION_STRING)\n", + " datasource = context.sources.add_postgres(\n", + " DATASOURCE_NAME, connection_string=DB_CONNECTION_STRING\n", + " )\n", " data_asset = datasource.add_table_asset(name=ASSET_NAME, table_name=TABLE_NAME)\n", - " \n", - " batch_definition = data_asset.add_batch_definition_whole_table(BATCH_DEFINITION_NAME_WHOLE_TABLE)\n", + "\n", + " batch_definition = data_asset.add_batch_definition_whole_table(\n", + " BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + " )\n", "\n", " print(\"Created entities\")\n", "\n", @@ -78,7 +82,11 @@ " datasource = context.get_datasource(DATASOURCE_NAME)\n", " assert isinstance(datasource, Datasource)\n", " data_asset = datasource.get_asset(asset_name=ASSET_NAME)\n", - " batch_definition = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE)\n", + " batch_definition = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + " )\n", "\n", " print(\"Entities alread exist - loaded them\")" ] @@ -103,7 +111,9 @@ "metadata": {}, "outputs": [], "source": [ - "expectation = gxe.ExpectColumnMinToBeBetween(column=\"passenger_count\", min_value=4, max_value=5)\n", + "expectation = gxe.ExpectColumnMinToBeBetween(\n", + " column=\"passenger_count\", min_value=4, max_value=5\n", + ")\n", "batch = batch_definition.get_batch()\n", "batch.validate(expectation)" ] @@ -152,11 +162,15 @@ " suite = context.suites.add(ExpectationSuite(name=SUITE_NAME))\n", "\n", " suite.add_expectation(expectation)\n", - " expectation = suite.add_expectation(gxe.ExpectColumnValuesToBeBetween(column=\"passenger_count\", min_value=0, max_value=4))\n", + " expectation = suite.add_expectation(\n", + " gxe.ExpectColumnValuesToBeBetween(\n", + " column=\"passenger_count\", min_value=0, max_value=4\n", + " )\n", + " )\n", " print(\"Expectation Suite created\")\n", "except exceptions.DataContextError:\n", " suite = context.suites.get(SUITE_NAME)\n", - " print(\"We've already added the suite\")\n" + " print(\"We've already added the suite\")" ] }, { @@ -195,7 +209,9 @@ "outputs": [], "source": [ "suite = context.suites.get(SUITE_NAME)\n", - "expectation = next(e for e in suite.expectations if isinstance(e, gxe.ExpectColumnValuesToBeBetween))\n", + "expectation = next(\n", + " e for e in suite.expectations if isinstance(e, gxe.ExpectColumnValuesToBeBetween)\n", + ")\n", "expectation.max_value = 10\n", "\n", "results = batch.validate(suite)\n", diff --git a/gx-1.0.0a2/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb b/gx-1.0.0a2/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb index 216e842..2b15de7 100644 --- a/gx-1.0.0a2/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb +++ b/gx-1.0.0a2/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb @@ -59,7 +59,11 @@ "\n", "suite = context.suites.get(SUITE_NAME)\n", "\n", - "batch_definition = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE)" + "batch_definition = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + ")" ] }, { @@ -103,14 +107,18 @@ "outputs": [], "source": [ "try:\n", - " checkpoint = context.checkpoints.add(Checkpoint(\n", - " name=CHECKPOINT_NAME,\n", - " validation_definitions=[\n", - " validation_definition,\n", - " ValidationDefinition(name=\"another\", data=batch_definition, suite=suite)\n", - " ],\n", - " actions=[UpdateDataDocsAction()]\n", - " ))\n", + " checkpoint = context.checkpoints.add(\n", + " Checkpoint(\n", + " name=CHECKPOINT_NAME,\n", + " validation_definitions=[\n", + " validation_definition,\n", + " ValidationDefinition(\n", + " name=\"another\", data=batch_definition, suite=suite\n", + " ),\n", + " ],\n", + " actions=[UpdateDataDocsAction()],\n", + " )\n", + " )\n", "except exceptions.DataContextError:\n", " checkpoint = context.checkpoints.get(name=CHECKPOINT_NAME)\n", "\n", diff --git a/gx-1.0.0a2/demos/notebooks/03-sql_month_and_year.ipynb b/gx-1.0.0a2/demos/notebooks/03-sql_month_and_year.ipynb index c638910..1e2fe1c 100644 --- a/gx-1.0.0a2/demos/notebooks/03-sql_month_and_year.ipynb +++ b/gx-1.0.0a2/demos/notebooks/03-sql_month_and_year.ipynb @@ -83,19 +83,26 @@ "source": [ "try:\n", " batch_def = data_asset.add_batch_definition_monthly(\n", - " BATCH_DEFINITION_NAME_PARTIONED,\n", - " column=\"tpep_pickup_datetime\"\n", + " BATCH_DEFINITION_NAME_PARTIONED, column=\"tpep_pickup_datetime\"\n", " )\n", " batch_def_desc = data_asset.add_batch_definition_monthly(\n", " BATCH_DEFINITION_NAME_PARTIONED_DESC,\n", " column=\"tpep_pickup_datetime\",\n", - " sort_ascending=False\n", + " sort_ascending=False,\n", " )\n", " print(\"Created BatchDefinitions\")\n", "except DataContextError:\n", - " batch_def = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_PARTIONED)\n", - " batch_def_desc = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_PARTIONED_DESC)\n", - " print(\"Entities already exist\")\n" + " batch_def = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_PARTIONED\n", + " )\n", + " batch_def_desc = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_PARTIONED_DESC\n", + " )\n", + " print(\"Entities already exist\")" ] }, { @@ -111,7 +118,9 @@ "metadata": {}, "outputs": [], "source": [ - "validation_definition = ValidationDefinition(name=\"ephemeral validation definition\", data=batch_def_desc, suite=suite)\n", + "validation_definition = ValidationDefinition(\n", + " name=\"ephemeral validation definition\", data=batch_def_desc, suite=suite\n", + ")\n", "\n", "results = validation_definition.run()\n", "print(results.describe())" diff --git a/gx-1.0.0a4/demos/notebooks/01-authoring_expectation_suites.ipynb b/gx-1.0.0a4/demos/notebooks/01-authoring_expectation_suites.ipynb index 329108b..96443bc 100644 --- a/gx-1.0.0a4/demos/notebooks/01-authoring_expectation_suites.ipynb +++ b/gx-1.0.0a4/demos/notebooks/01-authoring_expectation_suites.ipynb @@ -67,10 +67,14 @@ "context = gx.get_context(mode=\"file\")\n", "\n", "try:\n", - " datasource = context.data_sources.add_postgres(DATASOURCE_NAME, connection_string=DB_CONNECTION_STRING)\n", + " datasource = context.data_sources.add_postgres(\n", + " DATASOURCE_NAME, connection_string=DB_CONNECTION_STRING\n", + " )\n", " data_asset = datasource.add_table_asset(name=ASSET_NAME, table_name=TABLE_NAME)\n", - " \n", - " batch_definition = data_asset.add_batch_definition_whole_table(BATCH_DEFINITION_NAME_WHOLE_TABLE)\n", + "\n", + " batch_definition = data_asset.add_batch_definition_whole_table(\n", + " BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + " )\n", "\n", " print(\"Created entities\")\n", "\n", @@ -78,7 +82,11 @@ " datasource = context.get_datasource(DATASOURCE_NAME)\n", " assert isinstance(datasource, Datasource)\n", " data_asset = datasource.get_asset(asset_name=ASSET_NAME)\n", - " batch_definition = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE)\n", + " batch_definition = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + " )\n", "\n", " print(\"Entities alread exist - loaded them\")" ] @@ -103,7 +111,9 @@ "metadata": {}, "outputs": [], "source": [ - "expectation = gxe.ExpectColumnMinToBeBetween(column=\"passenger_count\", min_value=4, max_value=5)\n", + "expectation = gxe.ExpectColumnMinToBeBetween(\n", + " column=\"passenger_count\", min_value=4, max_value=5\n", + ")\n", "batch = batch_definition.get_batch()\n", "batch.validate(expectation)" ] @@ -152,11 +162,15 @@ " suite = context.suites.add(ExpectationSuite(name=SUITE_NAME))\n", "\n", " suite.add_expectation(expectation)\n", - " expectation = suite.add_expectation(gxe.ExpectColumnValuesToBeBetween(column=\"passenger_count\", min_value=0, max_value=4))\n", + " expectation = suite.add_expectation(\n", + " gxe.ExpectColumnValuesToBeBetween(\n", + " column=\"passenger_count\", min_value=0, max_value=4\n", + " )\n", + " )\n", " print(\"Expectation Suite created\")\n", "except exceptions.DataContextError:\n", " suite = context.suites.get(SUITE_NAME)\n", - " print(\"We've already added the suite\")\n" + " print(\"We've already added the suite\")" ] }, { @@ -195,7 +209,9 @@ "outputs": [], "source": [ "suite = context.suites.get(SUITE_NAME)\n", - "expectation = next(e for e in suite.expectations if isinstance(e, gxe.ExpectColumnValuesToBeBetween))\n", + "expectation = next(\n", + " e for e in suite.expectations if isinstance(e, gxe.ExpectColumnValuesToBeBetween)\n", + ")\n", "expectation.max_value = 10\n", "\n", "results = batch.validate(suite)\n", diff --git a/gx-1.0.0a4/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb b/gx-1.0.0a4/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb index e3f9084..bd2ad3e 100644 --- a/gx-1.0.0a4/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb +++ b/gx-1.0.0a4/demos/notebooks/02-validation-definitions-and-checkpoints.ipynb @@ -59,7 +59,11 @@ "\n", "suite = context.suites.get(SUITE_NAME)\n", "\n", - "batch_definition = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE)" + "batch_definition = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_WHOLE_TABLE\n", + ")" ] }, { @@ -103,14 +107,18 @@ "outputs": [], "source": [ "try:\n", - " checkpoint = context.checkpoints.add(Checkpoint(\n", - " name=CHECKPOINT_NAME,\n", - " validation_definitions=[\n", - " validation_definition,\n", - " ValidationDefinition(name=\"another\", data=batch_definition, suite=suite)\n", - " ],\n", - " actions=[UpdateDataDocsAction(name=\"update_data_docs\")]\n", - " ))\n", + " checkpoint = context.checkpoints.add(\n", + " Checkpoint(\n", + " name=CHECKPOINT_NAME,\n", + " validation_definitions=[\n", + " validation_definition,\n", + " ValidationDefinition(\n", + " name=\"another\", data=batch_definition, suite=suite\n", + " ),\n", + " ],\n", + " actions=[UpdateDataDocsAction(name=\"update_data_docs\")],\n", + " )\n", + " )\n", "except exceptions.DataContextError:\n", " checkpoint = context.checkpoints.get(name=CHECKPOINT_NAME)\n", "\n", diff --git a/gx-1.0.0a4/demos/notebooks/03-sql_month_and_year.ipynb b/gx-1.0.0a4/demos/notebooks/03-sql_month_and_year.ipynb index e1c4a22..8d18f7a 100644 --- a/gx-1.0.0a4/demos/notebooks/03-sql_month_and_year.ipynb +++ b/gx-1.0.0a4/demos/notebooks/03-sql_month_and_year.ipynb @@ -76,19 +76,26 @@ "source": [ "try:\n", " batch_def = data_asset.add_batch_definition_monthly(\n", - " BATCH_DEFINITION_NAME_PARTIONED,\n", - " column=\"tpep_pickup_datetime\"\n", + " BATCH_DEFINITION_NAME_PARTIONED, column=\"tpep_pickup_datetime\"\n", " )\n", " batch_def_desc = data_asset.add_batch_definition_monthly(\n", " BATCH_DEFINITION_NAME_PARTIONED_DESC,\n", " column=\"tpep_pickup_datetime\",\n", - " sort_ascending=False\n", + " sort_ascending=False,\n", " )\n", " print(\"Created BatchDefinitions\")\n", "except DataContextError:\n", - " batch_def = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_PARTIONED)\n", - " batch_def_desc = next(bd for bd in data_asset.batch_definitions if bd.name == BATCH_DEFINITION_NAME_PARTIONED_DESC)\n", - " print(\"Entities already exist\")\n" + " batch_def = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_PARTIONED\n", + " )\n", + " batch_def_desc = next(\n", + " bd\n", + " for bd in data_asset.batch_definitions\n", + " if bd.name == BATCH_DEFINITION_NAME_PARTIONED_DESC\n", + " )\n", + " print(\"Entities already exist\")" ] }, { @@ -104,7 +111,9 @@ "metadata": {}, "outputs": [], "source": [ - "validation_definition = ValidationDefinition(name=\"ephemeral validation definition\", data=batch_def_desc, suite=suite)\n", + "validation_definition = ValidationDefinition(\n", + " name=\"ephemeral validation definition\", data=batch_def_desc, suite=suite\n", + ")\n", "\n", "results = validation_definition.run()\n", "print(results.describe())"