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/store/database_store_backend.py b/great_expectations/data_context/store/database_store_backend.py
--- a/great_expectations/data_context/store/database_store_backend.py
+++ b/great_expectations/data_context/store/database_store_backend.py
@@ -2,7 +2,6 @@
 import uuid
 from pathlib import Path
 from typing import Dict, Tuple
-from urllib.parse import urlparse
 
 import great_expectations.exceptions as ge_exceptions
 from great_expectations.data_context.store.store_backend import StoreBackend
@@ -10,18 +9,8 @@
 
 try:
     import sqlalchemy as sa
-    from sqlalchemy import (
-        Column,
-        MetaData,
-        String,
-        Table,
-        and_,
-        column,
-        create_engine,
-        select,
-        text,
-    )
-    from sqlalchemy.engine.reflection import Inspector
+    from sqlalchemy import Column, MetaData, String, Table, and_, column, select
+    from sqlalchemy.engine import make_url
     from sqlalchemy.engine.url import URL
     from sqlalchemy.exc import IntegrityError, NoSuchTableError, SQLAlchemyError
 except ImportError:
@@ -80,7 +69,8 @@ def __init__(
         elif connection_string is not None:
             self.engine = sa.create_engine(connection_string, **kwargs)
         elif url is not None:
-            self.drivername = urlparse(url).scheme
+            parsed_url = make_url(url)
+            self.drivername = parsed_url.drivername
             self.engine = sa.create_engine(url, **kwargs)
         else:
             raise ge_exceptions.InvalidConfigError(
diff --git a/great_expectations/datasource/sqlalchemy_datasource.py b/great_expectations/datasource/sqlalchemy_datasource.py
--- a/great_expectations/datasource/sqlalchemy_datasource.py
+++ b/great_expectations/datasource/sqlalchemy_datasource.py
@@ -22,6 +22,7 @@
 try:
     import sqlalchemy
     from sqlalchemy import create_engine
+    from sqlalchemy.engine import make_url
     from sqlalchemy.sql.elements import quoted_name
 
 except ImportError:
@@ -257,7 +258,8 @@ def __init__(
                     connection.close()
                 elif "url" in credentials:
                     url = credentials.pop("url")
-                    self.drivername = urlparse(url).scheme
+                    parsed_url = make_url(url)
+                    self.drivername = parsed_url.drivername
                     self.engine = create_engine(url, **kwargs)
                     connection = self.engine.connect()
                     connection.close()
diff --git a/great_expectations/execution_engine/sqlalchemy_execution_engine.py b/great_expectations/execution_engine/sqlalchemy_execution_engine.py
--- a/great_expectations/execution_engine/sqlalchemy_execution_engine.py
+++ b/great_expectations/execution_engine/sqlalchemy_execution_engine.py
@@ -50,9 +50,7 @@
     sa = None
 
 try:
-    from sqlalchemy.engine import reflection
-    from sqlalchemy.engine.default import DefaultDialect
-    from sqlalchemy.engine.url import URL
+    from sqlalchemy.engine import make_url
     from sqlalchemy.exc import OperationalError
     from sqlalchemy.sql import Selectable
     from sqlalchemy.sql.elements import TextClause, quoted_name
@@ -247,7 +245,8 @@ def __init__(
             elif connection_string is not None:
                 self.engine = sa.create_engine(connection_string, **kwargs)
             elif url is not None:
-                self.drivername = urlparse(url).scheme
+                parsed_url = make_url(url)
+                self.drivername = parsed_url.drivername
                 self.engine = sa.create_engine(url, **kwargs)
             else:
                 raise InvalidConfigError(


Test patch: