Repository: apache/airflow

Issue:
Databricks SQL fails on Python 3.10
### Apache Airflow Provider(s)

databricks

### Versions of Apache Airflow Providers

The databricks SQL does not work on Python 3.10 due to "from collections import Iterable" in the `databricks-sql-connector`

* https://pypi.org/project/databricks-sql-connector/

Details of this issue dicussed in https://github.com/apache/airflow/pull/22050

For now we will likely just exclude the tests (and mark databricks provider as non-python 3.10 compatible). But once this is fixed (in either 1.0.2 or upcoming 2.0.0 version of the library, we wil restore it back). 

### Apache Airflow version

main (development)

### Operating System

All

### Deployment

Other

### Deployment details

Just Breeze with Python 3.10

### What happened

The tests are failing:

```
  self = <databricks.sql.common.ParamEscaper object at 0x7fe81c6dd6c0>
  item = ['file1', 'file2', 'file3']
  
      def escape_item(self, item):
          if item is None:
              return 'NULL'
          elif isinstance(item, (int, float)):
              return self.escape_number(item)
          elif isinstance(item, basestring):
              return self.escape_string(item)
  >       elif isinstance(item, collections.Iterable):
  E       AttributeError: module 'collections' has no attribute 'Iterable'
  ```

https://github.com/apache/airflow/runs/5523057543?check_suite_focus=true#step:8:16781 


### What you expected to happen

Test succeed :)

### How to reproduce

Run `TestDatabricksSqlCopyIntoOperator` in Python 3.10 environment.

### Anything else

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)



Discussion:
cc: @alexott  - I created an issue to track it (and proceed with excluding the failing test in Python 3.10 for now so that it does not block us from enabling 3.10 for Airflow main CI.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -264,7 +264,7 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version
 ]
 databricks = [
     'requests>=2.26.0, <3',
-    'databricks-sql-connector>=1.0.0, <2.0.0',
+    'databricks-sql-connector>=1.0.2, <2.0.0',
 ]
 datadog = [
     'datadog>=0.14.0',


Test patch:
diff --git a/tests/providers/databricks/operators/test_databricks_sql.py b/tests/providers/databricks/operators/test_databricks_sql.py
--- a/tests/providers/databricks/operators/test_databricks_sql.py
+++ b/tests/providers/databricks/operators/test_databricks_sql.py
@@ -24,7 +24,7 @@
 import pytest
 from databricks.sql.types import Row
 
-from airflow import PY310, AirflowException
+from airflow import AirflowException
 from airflow.providers.databricks.operators.databricks_sql import (
     DatabricksCopyIntoOperator,
     DatabricksSqlOperator,
@@ -83,12 +83,6 @@ def test_exec_write_file(self, db_mock_class):
         db_mock.run.assert_called_once_with(sql, parameters=None)
 
 
-@pytest.mark.skipif(
-    PY310,
-    reason="Databricks SQL tests not run on Python 3.10 because there is direct Iterable import from"
-    " collections in the databricks SQL library, where it should be imported from collections.abc."
-    " This could be removed when https://github.com/apache/airflow/issues/22220 is solved",
-)
 class TestDatabricksSqlCopyIntoOperator(unittest.TestCase):
     def test_copy_with_files(self):
         op = DatabricksCopyIntoOperator(