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/execution_engine/sqlalchemy_batch_data.py b/great_expectations/execution_engine/sqlalchemy_batch_data.py
--- a/great_expectations/execution_engine/sqlalchemy_batch_data.py
+++ b/great_expectations/execution_engine/sqlalchemy_batch_data.py
@@ -1,5 +1,4 @@
 import logging
-from typing import Union
 
 from great_expectations.execution_engine.execution_engine import BatchData
 from great_expectations.execution_engine.sqlalchemy_dialect import GESqlDialect
@@ -109,7 +108,13 @@ def __init__(
                 "schema_name can only be used with table_name. Use temp_table_schema_name to provide a target schema for creating a temporary table."
             )
 
-        dialect: GESqlDialect = GESqlDialect(engine.dialect.name.lower())
+        dialect_name: str = engine.dialect.name.lower()
+
+        try:
+            dialect: GESqlDialect = GESqlDialect(dialect_name)
+        except ValueError:
+            dialect: GESqlDialect = GESqlDialect.UNSUPPORTED
+
         if table_name:
             # Suggestion: pull this block out as its own _function
             if use_quoted_name:
@@ -201,9 +206,9 @@ def _create_temporary_table(
         dialect_name: str = self.sql_engine_dialect.name.lower()
 
         try:
-            dialect: Union[GESqlDialect, str] = GESqlDialect(dialect_name)
+            dialect: GESqlDialect = GESqlDialect(dialect_name)
         except ValueError:
-            dialect: Union[GESqlDialect, str] = dialect_name
+            dialect: GESqlDialect = GESqlDialect.UNSUPPORTED
 
         if dialect == GESqlDialect.BIGQUERY:
             # BigQuery Table is created using with an expiration of 24 hours using Google's Data Definition Language
diff --git a/great_expectations/execution_engine/sqlalchemy_dialect.py b/great_expectations/execution_engine/sqlalchemy_dialect.py
--- a/great_expectations/execution_engine/sqlalchemy_dialect.py
+++ b/great_expectations/execution_engine/sqlalchemy_dialect.py
@@ -5,6 +5,10 @@
 
 
 class GESqlDialect(enum.Enum):
+    """Contains sql dialects that have some level of support in Great Expectations.
+    Also contains an unsupported attribute if the dialect is not in the list.
+    """
+
     AWSATHENA = "awsathena"
     BIGQUERY = "bigquery"
     DREMIO = "dremio"
@@ -18,6 +22,7 @@ class GESqlDialect(enum.Enum):
     SQLITE = "sqlite"
     TERADATASQL = "teradatasql"
     TRINO = "trino"
+    UNSUPPORTED = "unsupported"
 
     @classmethod
     def _missing_(cls, value: Any) -> None:
@@ -30,9 +35,13 @@ def _missing_(cls, value: Any) -> None:
     @classmethod
     def get_all_dialect_names(cls) -> List[str]:
         """Get dialect names for all SQL dialects."""
-        return [dialect_name.value for dialect_name in cls]
+        return [
+            dialect_name.value
+            for dialect_name in cls
+            if dialect_name != GESqlDialect.UNSUPPORTED
+        ]
 
     @classmethod
     def get_all_dialects(cls) -> List[GESqlDialect]:
         """Get all dialects."""
-        return [dialect for dialect in cls]
+        return [dialect for dialect in cls if dialect != GESqlDialect.UNSUPPORTED]


Test patch:
diff --git a/tests/execution_engine/test_sqlalchemy_dialect.py b/tests/execution_engine/test_sqlalchemy_dialect.py
--- a/tests/execution_engine/test_sqlalchemy_dialect.py
+++ b/tests/execution_engine/test_sqlalchemy_dialect.py
@@ -7,3 +7,11 @@ def test_dialect_instantiation_with_string():
 
 def test_dialect_instantiation_with_byte_string():
     assert GESqlDialect(b"hive") == GESqlDialect.HIVE
+
+
+def test_get_all_dialect_names_no_unsupported():
+    assert GESqlDialect.UNSUPPORTED.value not in GESqlDialect.get_all_dialect_names()
+
+
+def test_get_all_dialects_no_unsupported():
+    assert GESqlDialect.UNSUPPORTED not in GESqlDialect.get_all_dialects()