kvesteri / sqlalchemy-continuum

Versioning extension for SQLAlchemy.
BSD 3-Clause "New" or "Revised" License
575 stars 127 forks source link

New warnings with SQLAlchemy 1.4 #263

Open TomGoBravo opened 2 years ago

TomGoBravo commented 2 years ago

When upgrading from SQLAlchemy 1.3.24 to 1.4.31 I see some new warnings. They also appear when with SQLAlchemy 1.4.1. I noticed these when running tests in my project and reproduced them by checking out master from this repo and running py.test tests/test_validity_strategy.py.

tests/test_validity_strategy.py::TestJoinTableInheritanceWithValidityVersioning::test_all_tables_contain_transaction_id_column
  sqlalchemy-continuum/sqlalchemy_continuum/table_builder.py:25: SADeprecationWarning: The Column.copy() method is deprecated and will be removed in a future release. (deprecated since: 1.4)
    column_copy = column.copy()
...
tests/test_validity_strategy.py::TestValidityStrategy::test_updated_end_transaction_id_of_previous_version
  sqlalchemy-continuum/sqlalchemy_continuum/unit_of_work.py:263: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
    ) == subquery,
marksteward commented 2 years ago

Yeah, as noted in https://github.com/kvesteri/sqlalchemy-continuum/pull/260 we've gone from ~650 warnings to ~5000 in 1.4. Any help fixing these gladly accepted! A lot of them are preparation for 2.0, such as the implicit .scalar issue.

On .copy, https://github.com/sqlalchemy/sqlalchemy/blob/main/doc/build/changelog/changelog_14.rst has this to say:

    Deprecated all schema-level ``.copy()`` methods and renamed to
    ``_copy()``.  These are not standard Python "copy()" methods as they
    typically rely upon being instantiated within particular contexts
    which are passed to the method as optional keyword arguments.   The
    :meth:`_schema.Table.tometadata` method is the public API that provides
    copying for :class:`_schema.Table` objects.
TomGoBravo commented 2 years ago

https://github.com/kvesteri/sqlalchemy-continuum/pull/269 is an attempt at fixing the .scalar issue.

josecsotomorales commented 2 years ago

Hey team, are we planning a release any time soon for the PR that fixes these warnings?

marksteward commented 2 years ago

269 fixes ~200 of the warnings, but there's still a long way to go. I'm a little busy right now, but will make time for any more PRs.

indiVar0508 commented 2 years ago

A bunch of PR for 1.4 were merged recently after that master has about 358 warning now.

I'll try to look into these and create PR(s) to fix.