Repository: modin-project/modin

Issue:
`dfsql` doesn't work correctly with python 3.10 and 3.11
Initially found: https://github.com/modin-project/modin/actions/runs/6148547460/job/16682507343?pr=6548

The main problem is that [the project](https://github.com/mindsdb/dfsql) is marked as archived, most likely new versions of Python will not be supported. 

<details>
<summary>Error logs: </summary>

```bash
_______________________________ test_string_cast _______________________________

    def test_string_cast():
        from modin.experimental.sql import query
    
        data = {"A": ["A", "B", "C"], "B": ["A", "B", "C"]}
        mdf = pd.DataFrame(data)
        pdf = pandas.DataFrame(data)
>       df_equals(pdf, query("SELECT * FROM df", df=mdf))

modin/experimental/sql/test/test_sql.py:83: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
modin/experimental/sql/__init__.py:45: in query
    from dfsql import sql_query as _query_impl
/usr/share/miniconda3/envs/modin/lib/python3.10/site-packages/dfsql/__init__.py:8: in <module>
    from dfsql.data_sources import DataSource
/usr/share/miniconda3/envs/modin/lib/python3.10/site-packages/dfsql/data_sources/__init__.py:1: in <module>
    from dfsql.data_sources.base_data_source import DataSource
/usr/share/miniconda3/envs/modin/lib/python3.10/site-packages/dfsql/data_sources/base_data_source.py:7: in <module>
    from dfsql.functions import OPERATION_MAPPING, AGGREGATE_MAPPING
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    import re
    from dfsql.engine import pd
>   from collections import Iterable
E   ImportError: cannot import name 'Iterable' from 'collections' (/usr/share/miniconda3/envs/modin/lib/python3.10/collections/__init__.py)

/usr/share/miniconda3/envs/modin/lib/python3.10/site-packages/dfsql/functions.py:3: ImportError
```
</details>

@modin-project/modin-core we need to decide whether to try to maintain the project ourselves, or remove this dependency (also considering that it is used only in experimental mode). In my opinion, deletion seems to be the best solution given the limited resources.


Discussion:
I support removing this dependency.

Resolving patch:
diff --git a/modin/experimental/sql/__init__.py b/modin/experimental/sql/__init__.py
--- a/modin/experimental/sql/__init__.py
+++ b/modin/experimental/sql/__init__.py
@@ -20,7 +20,7 @@
 
 def query(sql: str, *args, **kwargs) -> pd.DataFrame:
     """
-    Execute SQL query using either HDK engine or dfsql.
+    Execute SQL query using HDK engine.
 
     Parameters
     ----------
@@ -42,20 +42,6 @@ def query(sql: str, *args, **kwargs) -> pd.DataFrame:
         if cfg.StorageFormat.get() == "Hdk":
             from modin.experimental.sql.hdk.query import hdk_query as _query_impl
         else:
-            from dfsql import sql_query as _query_impl
+            raise NotImplementedError
 
     return _query_impl(sql, *args, **kwargs)
-
-
-# dfsql adds the sql() method to the DataFrame class.
-# This code is used for lazy dfsql extensions initialization.
-if not hasattr(pd.DataFrame, "sql"):
-
-    def dfsql_init(df, query):
-        delattr(pd.DataFrame, "sql")
-        import modin.experimental.sql.dfsql.query  # noqa: F401
-
-        df.sql = pd.DataFrame.sql(df)
-        return df.sql(query)
-
-    pd.DataFrame.sql = dfsql_init
diff --git a/modin/experimental/sql/dfsql/query.py b/modin/experimental/sql/dfsql/query.py
deleted file mode 100644
--- a/modin/experimental/sql/dfsql/query.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to Modin Development Team under one or more contributor license agreements.
-# See the NOTICE file distributed with this work for additional information regarding
-# copyright ownership.  The Modin Development Team licenses this file to you under the
-# Apache License, Version 2.0 (the "License"); you may not use this file except in
-# compliance with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software distributed under
-# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific language
-# governing permissions and limitations under the License.
-
-import warnings
-
-try:
-    from dfsql import sql_query as dfsql_query
-
-    # This import is required to inject the DataFrame.sql() method.
-    import dfsql.extensions  # noqa: F401
-except ImportError:
-    warnings.warn(
-        "Modin experimental sql interface requires dfsql to be installed."
-        + ' Run `pip install "modin[sql]"` to install it.'
-    )
-    raise
-
-__all__ = ["dfsql_query"]
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,6 @@
 ray_deps = ["ray[default]>=1.13.0,!=2.5.0", "pyarrow>=7.0.0", "pydantic<2"]
 unidist_deps = ["unidist[mpi]>=0.2.1"]
 spreadsheet_deps = ["modin-spreadsheet>=0.1.0"]
-sql_deps = ["dfsql>=0.4.2", "pyparsing<=2.4.7"]
 all_deps = dask_deps + ray_deps + unidist_deps + spreadsheet_deps
 
 # Distribute 'modin-autoimport-pandas.pth' along with binary and source distributions.
@@ -60,7 +59,6 @@ def make_distribution(self):
         "ray": ray_deps,
         "unidist": unidist_deps,
         "spreadsheet": spreadsheet_deps,
-        "sql": sql_deps,
         "all": all_deps,
     },
     python_requires=">=3.9",


Test patch:
diff --git a/modin/experimental/sql/test/test_sql.py b/modin/experimental/sql/test/test_sql.py
--- a/modin/experimental/sql/test/test_sql.py
+++ b/modin/experimental/sql/test/test_sql.py
@@ -13,8 +13,8 @@
 
 import pandas
 import modin.pandas as pd
-import modin.config as cfg
 from modin.pandas.test.utils import default_to_pandas_ignore_string, df_equals
+from modin.config import StorageFormat
 
 import io
 import pytest
@@ -34,6 +34,10 @@
 """
 
 
+@pytest.mark.skipif(
+    StorageFormat.get() != "Hdk",
+    reason="Lack of implementation for other storage formats.",
+)
 def test_sql_query():
     from modin.experimental.sql import query
 
@@ -52,28 +56,10 @@ def test_sql_query():
     assert (values_left == values_right).all()
 
 
-def test_sql_extension():
-    # This test is for DataFrame.sql() method, that is injected by
-    # dfsql.extensions. In the HDK environment, there is no dfsql
-    # module and, thus, this test fails.
-    if cfg.StorageFormat.get() == "Hdk":
-        return
-
-    import modin.experimental.sql  # noqa: F401
-
-    df = pd.read_csv(io.StringIO(titanic_snippet))
-
-    expected_df = df[df["survived"] == 1][["passenger_id", "survived"]]
-
-    sql = "SELECT passenger_id, survived WHERE survived = 1"
-    query_result = df.sql(sql)
-    assert list(query_result.columns) == ["passenger_id", "survived"]
-    values_left = expected_df.values
-    values_right = query_result.values
-    assert values_left.shape == values_right.shape
-    assert (values_left == values_right).all()
-
-
+@pytest.mark.skipif(
+    StorageFormat.get() != "Hdk",
+    reason="Lack of implementation for other storage formats.",
+)
 def test_string_cast():
     from modin.experimental.sql import query