Search code examples
pythonsqlalchemydependencieskedro

Python: kedro viz SQLAlchemy DeprecationWarning


I tried to work with kedro and started with the spaceflight tutorial. I installed the src/requirements.txt in a .venv. When running kedro viz (or kedro run or even kedro --version), I get lets of Deprecation Warnings. One of which is the following (relating to kedro viz)

kedro_viz\models\experiment_tracking.py:16: MovedIn20Warning: [31mDeprecated API features          warnings.py:109                             detected! These feature(s) are not compatible with SQLAlchemy 2.0. [32mTo prevent incompatible upgrades prior to updating applications, ensure requirements files
                             are pinned to "sqlalchemy<2.0". [36mSet environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable
                             SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message.[0m (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
                               Base = declarative_base()

Context

This is a minor issue, but ofc I would like to setup the project to be as clean as possible.

Steps to Reproduce

  1. Setup a fresh kedro installation (Version 0.18.4)
  2. Create a .venv and install the standard requirements
  3. Run any kedro command (e.g. kedro --version)

What I've tried

I tried to put sqlalchemy<=2.0 in the requirements.txt and again run pip install -r src/requirements.txt, but that did not resolve it. Double checked with pip freeze that the following version of SQLAlchemy is installed: SQLAlchemy==1.4.46


Solution

  • The deprecation warning is not an issue, it's just a announcement from the SQLAlchemy folks that 2.x.x is coming, at the time it's writing it's not been released.

    kedro-viz is pinned to sqlalchemy~=1.4 or (some of the datasets use "SQLAlchemy~=1.2"). The ~= operator is basically the same as saying sqlalchemy >= 1.4, <2. We will look to relax this once 0.2.x is released and we test if anything needs fixing.