Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/data_context/types/base.py b/great_expectations/data_context/types/base.py
--- a/great_expectations/data_context/types/base.py
+++ b/great_expectations/data_context/types/base.py
@@ -14,6 +14,7 @@
 
 import great_expectations.exceptions as ge_exceptions
 from great_expectations.core.batch import BatchRequestBase, get_batch_request_as_dict
+from great_expectations.core.configuration import AbstractConfig
 from great_expectations.core.run_identifier import RunIdentifier
 from great_expectations.core.util import (
     convert_to_json_serializable,
@@ -824,10 +825,15 @@ def make_execution_engine_config(self, data, **kwargs):
         return ExecutionEngineConfig(**data)
 
 
-class DatasourceConfig(SerializableDictDot):
+class DatasourceConfig(AbstractConfig):
     def __init__(
         self,
-        class_name=None,
+        name: Optional[
+            str
+        ] = None,  # Note: name is optional currently to avoid updating all documentation within
+        # the scope of this work.
+        id_: Optional[str] = None,
+        class_name: Optional[str] = None,
         module_name: str = "great_expectations.datasource",
         execution_engine=None,
         data_connectors=None,
@@ -846,6 +852,8 @@ def __init__(
         limit=None,
         **kwargs,
     ) -> None:
+
+        super().__init__(id_=id_, name=name)
         # NOTE - JPC - 20200316: Currently, we are mostly inconsistent with respect to this type...
         self._class_name = class_name
         self._module_name = module_name
@@ -925,6 +933,17 @@ class DatasourceConfigSchema(Schema):
     class Meta:
         unknown = INCLUDE
 
+    # Note: name is optional currently to avoid updating all documentation within
+    # the scope of this work.
+    name = fields.String(
+        required=False,
+        allow_none=True,
+    )
+    id = fields.String(
+        required=False,
+        allow_none=True,
+    )
+
     class_name = fields.String(
         required=False,
         allow_none=True,


Test patch:
diff --git a/tests/datasource/test_datasource_serialization.py b/tests/datasource/test_datasource_serialization.py
new file mode 100644
--- /dev/null
+++ b/tests/datasource/test_datasource_serialization.py
@@ -0,0 +1,45 @@
+"""Test v3 API datasource serialization."""
+import pytest
+
+from great_expectations.data_context.types.base import (
+    DatasourceConfig,
+    datasourceConfigSchema,
+)
+
+
+@pytest.mark.parametrize(
+    "datasource_config,expected_serialized_datasource_config",
+    [
+        pytest.param(
+            DatasourceConfig(
+                class_name="Datasource",
+            ),
+            {
+                "class_name": "Datasource",
+                "module_name": "great_expectations.datasource",
+            },
+            id="minimal",
+        ),
+        pytest.param(
+            DatasourceConfig(
+                name="my_datasource",
+                id_="d3a14abd-d4cb-4343-806e-55b555b15c28",
+                class_name="Datasource",
+            ),
+            {
+                "name": "my_datasource",
+                "id": "d3a14abd-d4cb-4343-806e-55b555b15c28",
+                "class_name": "Datasource",
+                "module_name": "great_expectations.datasource",
+            },
+            id="minimal_with_name_and_id",
+        ),
+    ],
+)
+def test_datasource_config_is_serialized(
+    datasource_config: DatasourceConfig, expected_serialized_datasource_config: dict
+):
+    """Datasource Config should be serialized appropriately with/without optional params."""
+    observed = datasourceConfigSchema.dump(datasource_config)
+
+    assert observed == expected_serialized_datasource_config
diff --git a/tests/integration/test_script_runner.py b/tests/integration/test_script_runner.py
--- a/tests/integration/test_script_runner.py
+++ b/tests/integration/test_script_runner.py
@@ -1297,26 +1297,26 @@ class IntegrationTestFixture:
 ]
 
 cloud_azure_tests = [
-    IntegrationTestFixture(
-        name="azure_pandas_configured_yaml",
-        user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/configured_yaml_example.py",
-        data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
-    ),
-    IntegrationTestFixture(
-        name="azure_pandas_configured_python",
-        user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/configured_python_example.py",
-        data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
-    ),
-    IntegrationTestFixture(
-        name="azure_pandas_inferred_and_runtime_yaml",
-        user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/inferred_and_runtime_yaml_example.py",
-        data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
-    ),
-    IntegrationTestFixture(
-        name="azure_pandas_inferred_and_runtime_python",
-        user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/inferred_and_runtime_python_example.py",
-        data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
-    ),
+    # IntegrationTestFixture(
+    #     name="azure_pandas_configured_yaml",
+    #     user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/configured_yaml_example.py",
+    #     data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
+    # ),
+    # IntegrationTestFixture(
+    #     name="azure_pandas_configured_python",
+    #     user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/configured_python_example.py",
+    #     data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
+    # ),
+    # IntegrationTestFixture(
+    #     name="azure_pandas_inferred_and_runtime_yaml",
+    #     user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/inferred_and_runtime_yaml_example.py",
+    #     data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
+    # ),
+    # IntegrationTestFixture(
+    #     name="azure_pandas_inferred_and_runtime_python",
+    #     user_flow_script="tests/integration/docusaurus/connecting_to_your_data/cloud/azure/pandas/inferred_and_runtime_python_example.py",
+    #     data_context_dir="tests/integration/fixtures/no_datasources/great_expectations",
+    # ),
     # TODO: <Alex>ALEX -- uncomment next four (4) tests once Spark in Azure Pipelines is enabled.</Alex>
     # IntegrationTestFixture(
     #     name = "azure_spark_configured_yaml",
diff --git a/tests/test_fixtures/configuration_for_testing_v2_v3_migration/postgresql/v3/great_expectations/great_expectations.yml b/tests/test_fixtures/configuration_for_testing_v2_v3_migration/postgresql/v3/great_expectations/great_expectations.yml
--- a/tests/test_fixtures/configuration_for_testing_v2_v3_migration/postgresql/v3/great_expectations/great_expectations.yml
+++ b/tests/test_fixtures/configuration_for_testing_v2_v3_migration/postgresql/v3/great_expectations/great_expectations.yml
@@ -23,10 +23,12 @@ datasources:
       connection_string: postgresql+psycopg2://postgres:@localhost/test_ci
     data_connectors:
       default_runtime_data_connector_name:
+        module_name: great_expectations.datasource.data_connector
         class_name: RuntimeDataConnector
         batch_identifiers:
           - default_identifier_name
       default_inferred_data_connector_name:
+        module_name: great_expectations.datasource.data_connector
         class_name: InferredAssetSqlDataConnector
         include_schema_name: true