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/cli/datasource.py b/great_expectations/cli/datasource.py
--- a/great_expectations/cli/datasource.py
+++ b/great_expectations/cli/datasource.py
@@ -39,6 +39,7 @@ class SupportedDatabaseBackends(enum.Enum):
     REDSHIFT = "Redshift"
     SNOWFLAKE = "Snowflake"
     BIGQUERY = "BigQuery"
+    TRINO = "Trino"
     OTHER = "other - Do you have a working SQLAlchemy connection string?"
     # TODO MSSQL
 
@@ -703,6 +704,41 @@ def _yaml_innards(self) -> str:
         return "\n  connection_string: {connection_string}"
 
 
+class TrinoCredentialYamlHelper(SQLCredentialYamlHelper):
+    def __init__(self, datasource_name: Optional[str]) -> None:
+        super().__init__(
+            database="YOUR_TRINO_CATALOG",
+            datasource_name=datasource_name,
+            usage_stats_payload={
+                "type": "sqlalchemy",
+                "db": SupportedDatabaseBackends.TRINO.value,
+                "api_version": "v3",
+            },
+            driver="trino",
+        )
+
+    def verify_libraries_installed(self) -> bool:
+        return verify_library_dependent_modules(
+            python_import_name="trino.sqlalchemy.dialect",
+            pip_library_name="trino",
+            module_names_to_reload=CLI_ONLY_SQLALCHEMY_ORDERED_DEPENDENCY_MODULE_NAMES,
+        )
+
+    def credentials_snippet(self) -> str:
+        return f'''\
+host = "{self.host}"
+port = "{self.port}"
+username = "{self.username}"
+password = "{self.password}"
+
+# Trino has a concept of catalog which maps to database
+database = "{self.database}"
+schema_name = "{self.schema_name}"
+
+# A table that you would like to add initially as a Data Asset
+table_name = "{self.table_name}"'''
+
+
 class ConnectionStringCredentialYamlHelper(SQLCredentialYamlHelper):
     def __init__(self, datasource_name: Optional[str]) -> None:
         super().__init__(
@@ -750,6 +786,7 @@ def _get_sql_yaml_helper_class(
         SupportedDatabaseBackends.REDSHIFT: RedshiftCredentialYamlHelper,
         SupportedDatabaseBackends.SNOWFLAKE: SnowflakeCredentialYamlHelper,
         SupportedDatabaseBackends.BIGQUERY: BigqueryCredentialYamlHelper,
+        SupportedDatabaseBackends.TRINO: TrinoCredentialYamlHelper,
         SupportedDatabaseBackends.OTHER: ConnectionStringCredentialYamlHelper,
     }
     helper_class = helper_class_by_backend[selected_database]
diff --git a/great_expectations/expectations/metrics/column_map_metrics/column_values_in_set.py b/great_expectations/expectations/metrics/column_map_metrics/column_values_in_set.py
--- a/great_expectations/expectations/metrics/column_map_metrics/column_values_in_set.py
+++ b/great_expectations/expectations/metrics/column_map_metrics/column_values_in_set.py
@@ -85,6 +85,7 @@ def _sqlalchemy_impl(column, value_set, **kwargs):
         if (
             sa
             and "_dialect" in kwargs
+            and hasattr(kwargs["_dialect"], "__name__")
             and kwargs["_dialect"].__name__ == "sqlalchemy_bigquery"
             and "_metrics" in kwargs
             and "table.column_types" in kwargs["_metrics"]
diff --git a/scripts/check_docstring_coverage.py b/scripts/check_docstring_coverage.py
--- a/scripts/check_docstring_coverage.py
+++ b/scripts/check_docstring_coverage.py
@@ -8,7 +8,7 @@
 Diagnostics = Dict[str, List[Tuple[ast.FunctionDef, bool]]]
 
 DOCSTRING_ERROR_THRESHOLD: int = (
-    1095  # This number is to be reduced as we document more public functions!
+    1097  # This number is to be reduced as we document more public functions!
 )
 
 logger = logging.getLogger(__name__)


Test patch:
diff --git a/tests/cli/test_datasource_sqlite.py b/tests/cli/test_datasource_sqlite.py
--- a/tests/cli/test_datasource_sqlite.py
+++ b/tests/cli/test_datasource_sqlite.py
@@ -237,7 +237,7 @@ def test_cli_datasource_new_connection_string(
     result = runner.invoke(
         cli,
         "--v3-api datasource new",
-        input="2\n6\n",
+        input="2\n7\n",
         catch_exceptions=False,
     )
     stdout = result.stdout