You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/28 17:11:38 UTC

[GitHub] [airflow] Dr-Denzy opened a new pull request #13955: Created DatabaseVersionCheckRule class

Dr-Denzy opened a new pull request #13955:
URL: https://github.com/apache/airflow/pull/13955


   This upgrade check inspects the version of the supported database
   backend (PostgreSQL, MySQL, and SQLite) so as to verify if the version
   is supported in Airflow 2.0
   
   This is ease upgrade to Airflow 2.0
   
   closes: #13850 
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770099150


   [The Workflow run](https://github.com/apache/airflow/actions/runs/522148966) is cancelling this PR. Building image for the PR has been cancelled


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567071742



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       You can compare the version in a better way:
   
   ```python
    from packaging.version import Version
   try:
       import importlib.metadata as importlib_metadata
   except ImportError:
       import importlib_metadata
   
   min_req_sqlite_vesion = Version('3.15')
   installed_sqlite_version =  Version(session.execute('select sqlite_version();').scalar())
   if installed_sqlite_version < min_req_sqlite_vesion:
       return "SQLite version below 3.15 not supported. \n" + more_info
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil merged pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #13955:
URL: https://github.com/apache/airflow/pull/13955


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770271420


   https://github.com/apache/airflow/pull/13920 should fix the failing doc test


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770248668


   I closed/reopened to trigger rebuild  - seems there was some temporary problem with one of the external sources for documentation. In 2.0 we have it cached but in 1.10 it is still not there.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Dr-Denzy commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
Dr-Denzy commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568560711



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       I agree - the return value from `SHOW server_version;` is terser compared to `SELECT VERSION();`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk closed pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #13955:
URL: https://github.com/apache/airflow/pull/13955


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568534745



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   
   ```python
   >>> session.execute("SHOW server_version;").scalar()
   '9.6.20'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Dr-Denzy commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
Dr-Denzy commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568560711



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       I agree - the return value from `SHOW server_version;` is terser compared to `SELECT VERSION();`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Dr-Denzy commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
Dr-Denzy commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567074245



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       oh cool! 

##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]

Review comment:
       I agree!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567069729



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]

Review comment:
       ```suggestion
               result = session.execute('select sqlite_version();').scalar()
   ```
   
   Would be much cleaner I think:
   
   ```python
   In [4]: session.execute('select sqlite_version();').fetchone()
   Out[4]: ('3.30.0',)
   
   In [5]: session.execute('select sqlite_version();').scalar()
   Out[5]: '3.30.0'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568534745



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   ```
   >>> session.execute("SHOW server_version;;").scalar()
   '9.6.20'
   ```

##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   
   ```python
   >>> session.execute("SHOW server_version;;").scalar()
   '9.6.20'
   ```

##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   
   ```python
   >>> session.execute("SHOW server_version;").scalar()
   '9.6.20'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-769330482


   [The Workflow run](https://github.com/apache/airflow/actions/runs/518956531) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-771684123


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770100036


   [The Workflow run](https://github.com/apache/airflow/actions/runs/522246065) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567071742



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       You can compare the version in a better way:
   
   ```python
    from packaging.version import Version
   
   min_req_sqlite_vesion = Version('3.15')
   installed_sqlite_version =  Version(session.execute('select sqlite_version();').scalar())
   if installed_sqlite_version < min_req_sqlite_vesion:
       return "SQLite version below 3.15 not supported. \n" + more_info
   ```

##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       Example:
   
   ```python
   In [5]: session.execute('select sqlite_version();').scalar()
   Out[5]: '3.30.0'
   
   In [7]: from packaging.version import Version
   
   In [8]: Version('3.30.0')
   Out[8]: <Version('3.30.0')>
   
   In [9]: Version('3.30.0') < Version('3.15')
   Out[9]: False
   
   In [10]: Version('3.3.0') < Version('3.15')
   Out[10]: True
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568534745



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   
   ```python
   >>> session.execute("SHOW server_version;;").scalar()
   '9.6.20'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r568534745



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from packaging.version import Version
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            min_req_sqlite_version = Version('3.15')
+            installed_sqlite_version = Version(session.execute('select sqlite_version();').scalar())
+            if installed_sqlite_version < min_req_sqlite_version:
+                return "From Airflow 2.0, SQLite version below 3.15 is no longer supported. \n" + more_info
+
+        elif "postgres" in conn_str:
+            min_req_postgres_version = Version('9.6')
+            query = session.execute('SELECT VERSION();').scalar()
+            installed_postgres_version = Version(query.split(' ')[1])

Review comment:
       Worth using `server_version` instead?:
   ```
   >>> session.execute("SHOW server_version;;").scalar()
   '9.6.20'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-771684123


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770100346


   [The Workflow run](https://github.com/apache/airflow/actions/runs/522247833) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567071742



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       You can compare the version in a better way:
   
   ```python
   from packaging.version import Version
   
   min_req_sqlite_vesion = Version('3.15')
   installed_sqlite_version =  Version(session.execute('select sqlite_version();').scalar())
   if installed_sqlite_version < min_req_sqlite_vesion:
       return "SQLite version below 3.15 not supported. \n" + more_info
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#discussion_r567072045



##########
File path: airflow/upgrade/rules/postgres_mysql_sqlite_version_upgrade_check.py
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+from airflow.utils.db import provide_session
+
+
+class DatabaseVersionCheckRule(BaseRule):
+
+    title = "Check versions of PostgreSQL, MySQL, and SQLite to ease upgrade to Airflow 2.0"
+
+    description = """\
+From Airflow 2.0, the following database versions are supported:
+PostgreSQl - 9.6, 10, 11, 12, 13;
+MySQL - 5.7, 8;
+SQLite - 3.15+
+    """
+
+    @provide_session
+    def check(self, session=None):
+
+        more_info = "See link below for more details: https://github.com/apache/airflow#requirements"
+
+        conn_str = conf.get(section="core", key="sql_alchemy_conn")
+
+        if "sqlite" in conn_str:
+            result = session.execute('select sqlite_version();').fetchone()[0]
+            if int(result.split('.')[0]) < 3:
+                return "SQLite version below 3.15 not supported. \n" + more_info
+            elif int(result.split('.')[0]) == 3 and int(result.split('.')[1]) < 15:
+                return "SQLite version below 3.15 not supported. \n" + more_info

Review comment:
       Example:
   
   ```python
   In [5]: session.execute('select sqlite_version();').scalar()
   Out[5]: '3.30.0'
   
   In [6]: import importlib_metadata
   
   In [7]: from packaging.version import Version
   
   In [8]: Version('3.30.0')
   Out[8]: <Version('3.30.0')>
   
   In [9]: Version('3.30.0') < Version('3.15')
   Out[9]: False
   
   In [10]: Version('3.3.0') < Version('3.15')
   Out[10]: True
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #13955: Created DatabaseVersionCheckRule class

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13955:
URL: https://github.com/apache/airflow/pull/13955#issuecomment-770098928


   [The Workflow run](https://github.com/apache/airflow/actions/runs/522238957) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org