Repository: modin-project/modin

Issue:
ImportError: Sqlalchemy
### Describe the problem
A `ModuleNotFoundError: No module named 'sqlalchemy'` gets thrown when trying to build a dataframe.

### Source code / logs
```
import modin.pandas as pd
pd.DataFrame({"col1": [1,2,3], "col2": [4,5,6]})
```
The above code results in the following:
```
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-3daf28a9e54f> in <module>
      2 #os.environ["MODIN_PARTITION"] = "Weld"
      3 
----> 4 import modin.pandas as pd

~/Documents/modin/modin/pandas/__init__.py in <module>
     83 
     84 from .. import __version__
---> 85 from .concat import concat
     86 from .dataframe import DataFrame
     87 from .datetimes import to_datetime

~/Documents/modin/modin/pandas/concat.py in <module>
      5 import pandas
      6 from pandas import compat
----> 7 from .dataframe import DataFrame
      8 
      9 

~/Documents/modin/modin/pandas/dataframe.py in <module>
     36 
     37 from modin.error_message import ErrorMessage
---> 38 from .utils import from_pandas, to_pandas, _inherit_docstrings
     39 from .iterator import PartitionIterator
     40 from .series import SeriesView

~/Documents/modin/modin/pandas/utils.py in <module>
      3 from __future__ import print_function
      4 
----> 5 from ..data_management.factories import BaseFactory
      6 
      7 

~/Documents/modin/modin/data_management/factories.py in <module>
    276 
    277 
--> 278 class ExperimentalPandasOnRayFactory(ExperimentalBaseFactory, PandasOnRayFactory):
    279 
    280     from modin.experimental.engines.pandas_on_ray.io_exp import (

~/Documents/modin/modin/data_management/factories.py in ExperimentalPandasOnRayFactory()
    278 class ExperimentalPandasOnRayFactory(ExperimentalBaseFactory, PandasOnRayFactory):
    279 
--> 280     from modin.experimental.engines.pandas_on_ray.io_exp import (
    281         ExperimentalPandasOnRayIO,
    282     )

~/Documents/modin/modin/experimental/engines/pandas_on_ray/io_exp.py in <module>
      5 from modin.engines.ray.pandas_on_ray.io import PandasOnRayIO, _split_result_for_readers
      6 from modin.engines.ray.pandas_on_ray.remote_partition import PandasOnRayRemotePartition
----> 7 from .sql import is_distributed, get_query_info, query_put_bounders
      8 
      9 

~/Documents/modin/modin/experimental/engines/pandas_on_ray/sql.py in <module>
      1 from collections import OrderedDict
----> 2 from sqlalchemy import MetaData, Table, create_engine
      3 
      4 
      5 def is_distributed(partition_column, lower_bound, upper_bound):

ModuleNotFoundError: No module named 'sqlalchemy'
```


Discussion:

Resolving patch:
diff --git a/modin/experimental/engines/pandas_on_ray/io_exp.py b/modin/experimental/engines/pandas_on_ray/io_exp.py
--- a/modin/experimental/engines/pandas_on_ray/io_exp.py
+++ b/modin/experimental/engines/pandas_on_ray/io_exp.py
@@ -4,7 +4,6 @@
 
 from modin.engines.ray.pandas_on_ray.io import PandasOnRayIO, _split_result_for_readers
 from modin.engines.ray.pandas_on_ray.remote_partition import PandasOnRayRemotePartition
-from .sql import is_distributed, get_query_info, query_put_bounders
 
 
 class ExperimentalPandasOnRayIO(PandasOnRayIO):
@@ -53,6 +52,8 @@ def read_sql(
         Returns:
             Pandas Dataframe
         """
+        from .sql import is_distributed, get_query_info
+
         if not is_distributed(partition_column, lower_bound, upper_bound):
             # Change this so that when `PandasOnRayIO` has a parallel `read_sql` we can
             # still use it.
@@ -131,6 +132,9 @@ def _read_sql_with_offset_pandas_on_ray(
 
     Note: Ray functions are not detected by codecov (thus pragma: no cover)
     """
+
+    from .sql import query_put_bounders
+
     query_with_bounders = query_put_bounders(sql, partition_column, start, end)
     pandas_df = pandas.read_sql(
         query_with_bounders,


Test patch: