Hello community,

here is the log from the commit of package python-SQLAlchemy-Utils for 
openSUSE:Factory checked in at 2020-11-25 19:29:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-SQLAlchemy-Utils (Old)
 and      /work/SRC/openSUSE:Factory/.python-SQLAlchemy-Utils.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-SQLAlchemy-Utils"

Wed Nov 25 19:29:37 2020 rev:28 rq:850134 version:0.36.8

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-SQLAlchemy-Utils/python-SQLAlchemy-Utils.changes
  2020-06-10 00:47:35.626815897 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-SQLAlchemy-Utils.new.5913/python-SQLAlchemy-Utils.changes
        2020-11-25 19:30:23.786559014 +0100
@@ -1,0 +2,10 @@
+Sat Jul 11 18:37:48 UTC 2020 - Arun Persaud <[email protected]>
+
+- update to version 0.36.8:
+  * Don't connect to 'postgres' data base for database existence check
+    (#372, pull request courtesy of bernt-matthias)
+
+- changes from version 0.36.7:
+  * Fix dynamic relationships for observables (#455)
+
+-------------------------------------------------------------------

Old:
----
  SQLAlchemy-Utils-0.36.6.tar.gz

New:
----
  SQLAlchemy-Utils-0.36.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-SQLAlchemy-Utils.spec ++++++
--- /var/tmp/diff_new_pack.nkMBvT/_old  2020-11-25 19:30:25.018560227 +0100
+++ /var/tmp/diff_new_pack.nkMBvT/_new  2020-11-25 19:30:25.022560230 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-SQLAlchemy-Utils
-Version:        0.36.6
+Version:        0.36.8
 Release:        0
 Summary:        Various utility functions for SQLAlchemy
 License:        BSD-3-Clause
@@ -97,7 +97,7 @@
 rm tests/types/test_composite.py
 rm tests/types/test_ltree.py
 rm tests/types/test_tsvector.py
-%pytest -k 'not (TestDatabasePostgres or TestDatabaseMssql or OnPostgres or 
OnMysql or TestPostgres or TestMysql or TestSortQueryRelationshipCounts or 
TestSortQueryWithPolymorphicInheritance or TestMaterializedViews or 
TestLazyEvaluatedSelectExpressionsForAggregates or 
TestAggregatesWithManyToManyRelationships or 
TestAggregateManyToManyAndManyToMany or TestAggregateOneToManyAndOneToMany or 
TestJSONSQL or TestJSONBSQL or TestSortQueryWithCustomPolymorphic or 
TestAggregateOneToManyAndManyToMany or test_timezone)'
+%pytest -rs -k 'not (TestDatabasePostgres or TestDatabaseMssql or OnPostgres 
or OnMysql or TestPostgres or TestMysql or TestSortQueryRelationshipCounts or 
TestSortQueryWithPolymorphicInheritance or TestMaterializedViews or 
TestLazyEvaluatedSelectExpressionsForAggregates or 
TestAggregatesWithManyToManyRelationships or 
TestAggregateManyToManyAndManyToMany or TestAggregateOneToManyAndOneToMany or 
TestJSONSQL or TestJSONBSQL or TestSortQueryWithCustomPolymorphic or 
TestAggregateOneToManyAndManyToMany or test_timezone or 
test_add_observed_object)'
 
 %files %{python_files}
 %license LICENSE

++++++ SQLAlchemy-Utils-0.36.6.tar.gz -> SQLAlchemy-Utils-0.36.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/CHANGES.rst 
new/SQLAlchemy-Utils-0.36.8/CHANGES.rst
--- old/SQLAlchemy-Utils-0.36.6/CHANGES.rst     2020-05-24 20:29:41.000000000 
+0200
+++ new/SQLAlchemy-Utils-0.36.8/CHANGES.rst     2020-07-08 10:20:24.000000000 
+0200
@@ -4,6 +4,18 @@
 Here you can see the full list of changes between each SQLAlchemy-Utils 
release.
 
 
+0.36.8 (2020-07-08)
+^^^^^^^^^^^^^^^^^^^
+
+- Don't connect to 'postgres' data base for database existence check (#372, 
pull request courtesy of bernt-matthias)
+
+
+0.36.7 (2020-07-02)
+^^^^^^^^^^^^^^^^^^^
+
+- Fix dynamic relationships for observables (#455)
+
+
 0.36.6 (2020-05-24)
 ^^^^^^^^^^^^^^^^^^^
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/PKG-INFO 
new/SQLAlchemy-Utils-0.36.8/PKG-INFO
--- old/SQLAlchemy-Utils-0.36.6/PKG-INFO        2020-05-24 20:36:31.000000000 
+0200
+++ new/SQLAlchemy-Utils-0.36.8/PKG-INFO        2020-07-08 10:34:55.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: SQLAlchemy-Utils
-Version: 0.36.6
+Version: 0.36.8
 Summary: Various utility functions for SQLAlchemy.
 Home-page: https://github.com/kvesteri/sqlalchemy-utils
 Author: Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.36.6/SQLAlchemy_Utils.egg-info/PKG-INFO 
new/SQLAlchemy-Utils-0.36.8/SQLAlchemy_Utils.egg-info/PKG-INFO
--- old/SQLAlchemy-Utils-0.36.6/SQLAlchemy_Utils.egg-info/PKG-INFO      
2020-05-24 20:36:30.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/SQLAlchemy_Utils.egg-info/PKG-INFO      
2020-07-08 10:34:55.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: SQLAlchemy-Utils
-Version: 0.36.6
+Version: 0.36.8
 Summary: Various utility functions for SQLAlchemy.
 Home-page: https://github.com/kvesteri/sqlalchemy-utils
 Author: Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.36.6/SQLAlchemy_Utils.egg-info/SOURCES.txt 
new/SQLAlchemy-Utils-0.36.8/SQLAlchemy_Utils.egg-info/SOURCES.txt
--- old/SQLAlchemy-Utils-0.36.6/SQLAlchemy_Utils.egg-info/SOURCES.txt   
2020-05-24 20:36:30.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/SQLAlchemy_Utils.egg-info/SOURCES.txt   
2020-07-08 10:34:55.000000000 +0200
@@ -166,6 +166,7 @@
 tests/generic_relationship/test_single_table_inheritance.py
 tests/observes/__init__.py
 tests/observes/test_column_property.py
+tests/observes/test_dynamic_relationship.py
 tests/observes/test_m2m_m2m_m2m.py
 tests/observes/test_o2m_o2m_o2m.py
 tests/observes/test_o2m_o2o_o2m.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/__init__.py 
new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/__init__.py
--- old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/__init__.py    2020-05-24 
20:19:30.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/__init__.py    2020-07-08 
10:20:33.000000000 +0200
@@ -103,4 +103,4 @@
     refresh_materialized_view
 )
 
-__version__ = '0.36.6'
+__version__ = '0.36.8'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/functions/database.py 
new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/functions/database.py
--- old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/functions/database.py  
2020-05-24 20:27:07.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/functions/database.py  
2020-07-08 10:20:40.000000000 +0200
@@ -1,9 +1,6 @@
-try:
-    from collections.abc import Mapping, Sequence
-except ImportError:  # For python 2.7 support
-    from collections import Mapping, Sequence
 import itertools
 import os
+from collections.abc import Mapping, Sequence
 from copy import copy
 
 import sqlalchemy as sa
@@ -461,12 +458,7 @@
         return header[:16] == b'SQLite format 3\x00'
 
     url = copy(make_url(url))
-    database = url.database
-    if url.drivername.startswith('postgres'):
-        url.database = 'postgres'
-    else:
-        url.database = None
-
+    database, url.database = url.database, None
     engine = sa.create_engine(url)
 
     if engine.dialect.name == 'postgresql':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/generic.py 
new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/generic.py
--- old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/generic.py     2019-08-20 
13:55:26.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/generic.py     2020-07-02 
08:31:29.000000000 +0200
@@ -1,7 +1,4 @@
-try:
-    from collections.abc import Iterable
-except ImportError:  # For python 2.7 support
-    from collections import Iterable
+from collections.abc import Iterable
 
 import six
 import sqlalchemy as sa
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/observer.py 
new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/observer.py
--- old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/observer.py    2019-11-01 
11:18:12.000000000 +0100
+++ new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/observer.py    2020-07-02 
09:15:23.000000000 +0200
@@ -174,6 +174,7 @@
 """
 import itertools
 from collections import defaultdict, namedtuple
+from collections.abc import Iterable
 
 import sqlalchemy as sa
 
@@ -181,11 +182,6 @@
 from .path import AttrPath
 from .utils import is_sequence
 
-try:
-    from collections.abc import Iterable
-except ImportError:  # For python 2.7 support
-    from collections import Iterable
-
 Callback = namedtuple('Callback', ['func', 'backref', 'fullpath'])
 
 
@@ -265,6 +261,7 @@
                             )
 
     def gather_callback_args(self, obj, callbacks):
+        session = sa.orm.object_session(obj)
         for callback in callbacks:
             backref = callback.backref
 
@@ -273,11 +270,12 @@
                 if not isinstance(root_objs, Iterable):
                     root_objs = [root_objs]
 
-                for root_obj in root_objs:
-                    if root_obj:
-                        args = self.get_callback_args(root_obj, callback)
-                        if args:
-                            yield args
+                with session.no_autoflush:
+                    for root_obj in root_objs:
+                        if root_obj:
+                            args = self.get_callback_args(root_obj, callback)
+                            if args:
+                                yield args
 
     def get_callback_args(self, root_obj, callback):
         session = sa.orm.object_session(root_obj)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/utils.py 
new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/utils.py
--- old/SQLAlchemy-Utils-0.36.6/sqlalchemy_utils/utils.py       2019-08-20 
13:55:26.000000000 +0200
+++ new/SQLAlchemy-Utils-0.36.8/sqlalchemy_utils/utils.py       2020-07-02 
09:15:23.000000000 +0200
@@ -1,20 +1,11 @@
-import sys
+from collections.abc import Iterable
 
 import six
 
-try:
-    from collections.abc import Iterable
-except ImportError:  # For python 2.7 support
-    from collections import Iterable
-
 
 def str_coercible(cls):
-    if sys.version_info[0] >= 3:  # Python 3
-        def __str__(self):
-            return self.__unicode__()
-    else:  # Python 2
-        def __str__(self):
-            return self.__unicode__().encode('utf8')
+    def __str__(self):
+        return self.__unicode__()
 
     cls.__str__ = __str__
     return cls
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SQLAlchemy-Utils-0.36.6/tests/observes/test_dynamic_relationship.py 
new/SQLAlchemy-Utils-0.36.8/tests/observes/test_dynamic_relationship.py
--- old/SQLAlchemy-Utils-0.36.6/tests/observes/test_dynamic_relationship.py     
1970-01-01 01:00:00.000000000 +0100
+++ new/SQLAlchemy-Utils-0.36.8/tests/observes/test_dynamic_relationship.py     
2020-07-02 09:15:23.000000000 +0200
@@ -0,0 +1,57 @@
+import pytest
+import sqlalchemy as sa
+from sqlalchemy.orm import dynamic_loader
+
+from sqlalchemy_utils.observer import observes
+
+
[email protected]
+def Director(Base):
+    class Director(Base):
+        __tablename__ = 'director'
+        id = sa.Column(sa.Integer, primary_key=True)
+        name = sa.Column(sa.String)
+        movies = dynamic_loader('Movie', back_populates='director')
+
+    return Director
+
+
[email protected]
+def Movie(Base, Director):
+    class Movie(Base):
+        __tablename__ = 'movie'
+        id = sa.Column(sa.Integer, primary_key=True)
+        name = sa.Column(sa.String)
+        director_id = sa.Column(sa.Integer, sa.ForeignKey(Director.id))
+        director = sa.orm.relationship(Director, back_populates='movies')
+        director_name = sa.Column(sa.String)
+
+        @observes('director')
+        def director_observer(self, director):
+            self.director_name = director.name
+
+    return Movie
+
+
[email protected]
+def init_models(Director, Movie):
+    pass
+
+
[email protected]('postgresql_dsn')
+class TestObservesForDynamicRelationship:
+    def test_add_observed_object(self, session, Director, Movie):
+        steven = Director(name='Steven Spielberg')
+        session.add(steven)
+        jaws = Movie(name='Jaws', director=steven)
+        session.add(jaws)
+        session.commit()
+        assert jaws.director_name == 'Steven Spielberg'
+
+    def test_add_observed_object_from_backref(self, session, Director, Movie):
+        jaws = Movie(name='Jaws')
+        steven = Director(name='Steven Spielberg', movies=[jaws])
+        session.add(steven)
+        session.add(jaws)
+        session.commit()
+        assert jaws.director_name == 'Steven Spielberg'
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to