This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via 86aa2af44e73569ca1bbbdc4947209f3d58b6143 (commit)
via e628604d8aa2a796883a020abd3c52a54b477d8f (commit)
via e0fa0ab0500747efe2e16e5bdcb301a266e55de0 (commit)
via a4ee6cdb15c8e253db0d81cd766396d66bfd2e61 (commit)
via 0ecd7da093be2152e2da955004bd66003e3dad8f (commit)
via 79294e3d5d6f2d728093a873265d035496c9349f (commit)
from 423a0f74a5a995e6b1de1a9c861641ecfd836d7d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/86aa2af44e73569ca1bbbdc4947209f3d58b6143
commit 86aa2af44e73569ca1bbbdc4947209f3d58b6143
Author: Oleg Broytman <ph...@ph...>
Date: Wed Aug 9 15:11:03 2023 +0300
Build: Prepare for the next release
[skip ci]
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index d5bdebc..b58c9a3 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -1,7 +1,19 @@
Hello!
-I'm pleased to announce version 3.10.2, a minor feature release
-and the second bugfix release of branch 3.10 of SQLObject.
+I'm pleased to announce version 3.10.3a1, the first alpha of the upcoming
+release of branch 3.10 of SQLObject.
+
+I'm pleased to announce version 3.10.3a2, the second alpha of the upcoming
+release of branch 3.10 of SQLObject.
+
+I'm pleased to announce version 3.10.3b1, the first beta of the upcoming
+release of branch 3.10 of SQLObject.
+
+I'm pleased to announce version 3.10.3rc1, the first release candidate
+of the upcoming release of branch 3.10 of SQLObject.
+
+I'm pleased to announce version 3.10.3, the first bugfix release of branch
+3.10 of SQLObject.
What's new in SQLObject
@@ -51,7 +63,7 @@ Site:
http://sqlobject.org
Download:
-https://pypi.org/project/SQLObject/3.10.2a0.dev20221222/
+https://pypi.org/project/SQLObject/3.10.3a0.dev20230810/
News and changes:
http://sqlobject.org/News.html
diff --git a/README.rst b/README.rst
index e3ff798..3b336e9 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
-SQLObject 3.10.2
-================
+SQLObject 3.10.3a0
+==================
SQLObject is a free and open-source (LGPL) Python object-relational
mapper. Your database tables are described as classes, and rows are
diff --git a/docs/News.rst b/docs/News.rst
index 5180fbc..2d05200 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -5,6 +5,9 @@ News
.. contents:: Contents:
:backlinks: none
+SQLObject (master)
+==================
+
SQLObject 3.10.2
================
http://sourceforge.net/p/sqlobject/sqlobject/ci/e628604d8aa2a796883a020abd3c52a54b477d8f
commit e628604d8aa2a796883a020abd3c52a54b477d8f
Author: Oleg Broytman <ph...@ph...>
Date: Wed Aug 9 14:01:26 2023 +0300
Release 3.10.2
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 1b1914e..d5bdebc 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -1,19 +1,7 @@
Hello!
-I'm pleased to announce version 3.10.2a1, the first alpha of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.2a2, the second alpha of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.2b1, the first beta of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.2rc1, the first release candidate
-of the upcoming release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.2, the first bugfix release of branch
-3.10 of SQLObject.
+I'm pleased to announce version 3.10.2, a minor feature release
+and the second bugfix release of branch 3.10 of SQLObject.
What's new in SQLObject
diff --git a/README.rst b/README.rst
index 3896cef..e3ff798 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
-SQLObject 3.10.2a0
-==================
+SQLObject 3.10.2
+================
SQLObject is a free and open-source (LGPL) Python object-relational
mapper. Your database tables are described as classes, and rows are
diff --git a/devscripts/build-all-docs b/devscripts/build-all-docs
index 8da2c52..d633b09 100755
--- a/devscripts/build-all-docs
+++ b/devscripts/build-all-docs
@@ -10,7 +10,7 @@ cd "`dirname \"$0\"`" &&
PROG_DIR="`pwd`" &&
cd .. &&
-build_docs 3.10.1 &&
+build_docs 3.10.2 &&
build_docs master devel &&
rm -rf docs/html &&
diff --git a/docs/News.rst b/docs/News.rst
index 3525ea2..5180fbc 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -5,8 +5,10 @@ News
.. contents:: Contents:
:backlinks: none
-SQLObject (master)
-==================
+SQLObject 3.10.2
+================
+
+Released 2023 Aug 09.
Minor features
--------------
diff --git a/sqlobject/__version__.py b/sqlobject/__version__.py
index 7753d96..8bf191f 100644
--- a/sqlobject/__version__.py
+++ b/sqlobject/__version__.py
@@ -1,8 +1,8 @@
-version = '3.10.1'
+version = '3.10.2'
major = 3
minor = 10
-micro = 1
+micro = 2
release_level = 'final'
serial = 0
version_info = (major, minor, micro, release_level, serial)
http://sourceforge.net/p/sqlobject/sqlobject/ci/e0fa0ab0500747efe2e16e5bdcb301a266e55de0
commit e0fa0ab0500747efe2e16e5bdcb301a266e55de0
Merge: 423a0f7 a4ee6cd
Author: Oleg Broytman <ph...@ph...>
Date: Tue Aug 8 22:42:54 2023 +0300
Merge branch 'issue-185'
* branch 'issue-185':
Fix(SQLRelatedJoin): Fixed a bug when the table joins with itself
Feat(SQLBuilder): Add detailed error message
Feat(SQLBuilder): Add method `Alias.select()`
http://sourceforge.net/p/sqlobject/sqlobject/ci/a4ee6cdb15c8e253db0d81cd766396d66bfd2e61
commit a4ee6cdb15c8e253db0d81cd766396d66bfd2e61
Author: Oleg Broytman <ph...@ph...>
Date: Fri Jul 28 23:54:08 2023 +0300
Fix(SQLRelatedJoin): Fixed a bug when the table joins with itself
In the resulting SQL two instances of the table must use different
aliases.
Fixes: #185.
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 3d251d9..1b1914e 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -19,13 +19,20 @@ I'm pleased to announce version 3.10.2, the first bugfix release of branch
What's new in SQLObject
=======================
-Contributors for this release are
+The contributor for this release is Igor Yudytskiy.
Minor features
--------------
* Class ``Alias`` grows a method ``.select()`` to match ``SQLObject.select()``.
+Bug fixes
+---------
+
+* Fixed a bug in ``SQLRelatedJoin`` in the case where the table joins with
+ itself; in the resulting SQL two instances of the table must use different
+ aliases. Thanks to Igor Yudytskiy for providing an elaborated bug report.
+
For a more complete list, please see the news:
http://sqlobject.org/News.html
diff --git a/docs/News.rst b/docs/News.rst
index 9a0a05a..3525ea2 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -13,6 +13,13 @@ Minor features
* Class ``Alias`` grows a method ``.select()`` to match ``SQLObject.select()``.
+Bug fixes
+---------
+
+* Fixed a bug in ``SQLRelatedJoin`` in the case where the table joins with
+ itself; in the resulting SQL two instances of the table must use different
+ aliases.
+
CI
--
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index e2c835a..fa2b337 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -298,11 +298,14 @@ class OtherTableToJoin(sqlbuilder.SQLExpression):
self.joinColumn = joinColumn
def tablesUsedImmediate(self):
- return [self.otherTable, self.interTable]
+ return [
+ '%s _SO_SQLRelatedJoin_OtherTable' % self.otherTable,
+ self.interTable,
+ ]
def __sqlrepr__(self, db):
- return '%s.%s = %s.%s' % (self.otherTable, self.otherIdName,
- self.interTable, self.joinColumn)
+ return '_SO_SQLRelatedJoin_OtherTable.%s = %s.%s' % (
+ self.otherIdName, self.interTable, self.joinColumn)
class JoinToTable(sqlbuilder.SQLExpression):
@@ -313,11 +316,14 @@ class JoinToTable(sqlbuilder.SQLExpression):
self.joinColumn = joinColumn
def tablesUsedImmediate(self):
- return [self.table, self.interTable]
+ return [
+ '%s _SO_SQLRelatedJoin_ThisTable' % self.table,
+ self.interTable,
+ ]
def __sqlrepr__(self, db):
- return '%s.%s = %s.%s' % (self.interTable, self.joinColumn, self.table,
- self.idName)
+ return '%s.%s = _SO_SQLRelatedJoin_ThisTable.%s' % (
+ self.interTable, self.joinColumn, self.idName)
class TableToId(sqlbuilder.SQLExpression):
@@ -327,10 +333,11 @@ class TableToId(sqlbuilder.SQLExpression):
self.idValue = idValue
def tablesUsedImmediate(self):
- return [self.table]
+ return ['%s _SO_SQLRelatedJoin_ThisTable' % self.table]
def __sqlrepr__(self, db):
- return '%s.%s = %s' % (self.table, self.idName, self.idValue)
+ return '_SO_SQLRelatedJoin_ThisTable.%s = %s' % (
+ self.idName, self.idValue)
class SOSQLRelatedJoin(SORelatedJoin):
@@ -339,7 +346,9 @@ class SOSQLRelatedJoin(SORelatedJoin):
conn = inst._connection
else:
conn = None
- results = self.otherClass.select(sqlbuilder.AND(
+ results = sqlbuilder.Alias(
+ self.otherClass, '_SO_SQLRelatedJoin_OtherTable'
+ ).select(sqlbuilder.AND(
OtherTableToJoin(
self.otherClass.sqlmeta.table, self.otherClass.sqlmeta.idName,
self.intermediateTable, self.otherColumn
@@ -350,9 +359,11 @@ class SOSQLRelatedJoin(SORelatedJoin):
),
TableToId(self.soClass.sqlmeta.table, self.soClass.sqlmeta.idName,
inst.id),
- ), clauseTables=(self.soClass.sqlmeta.table,
- self.otherClass.sqlmeta.table,
- self.intermediateTable),
+ ), clauseTables=(
+ '%s _SO_SQLRelatedJoin_ThisTable' % self.soClass.sqlmeta.table,
+ '%s _SO_SQLRelatedJoin_OtherTable' %
+ self.otherClass.sqlmeta.table,
+ self.intermediateTable),
connection=conn)
return results.orderBy(self.orderBy)
diff --git a/sqlobject/tests/test_SQLRelatedJoin.py b/sqlobject/tests/test_SQLRelatedJoin.py
index 7620258..5e235dd 100644
--- a/sqlobject/tests/test_SQLRelatedJoin.py
+++ b/sqlobject/tests/test_SQLRelatedJoin.py
@@ -1,5 +1,6 @@
import pytest
-from sqlobject import RelatedJoin, SQLObject, SQLRelatedJoin, StringCol
+from sqlobject import RelatedJoin, SQLObject, SQLRelatedJoin, StringCol, \
+ ForeignKey
from sqlobject.tests.dbtest import setupClass, supports
@@ -62,3 +63,29 @@ def test_related_join_transaction():
finally:
trans.commit(True)
Tourtment._connection.autoCommit = True
+
+
+class RecursiveGroup(SQLObject):
+ name = StringCol(length=255, unique=True)
+ subgroups = SQLRelatedJoin(
+ 'RecursiveGroup',
+ otherColumn='group_id',
+ intermediateTable='rec_group_map',
+ createRelatedTable=False,
+ )
+
+
+class RecGroupMap(SQLObject):
+ recursive_group = ForeignKey('RecursiveGroup')
+ group = ForeignKey('RecursiveGroup')
+
+
+def test_rec_group():
+ setupClass([RecursiveGroup, RecGroupMap])
+ a = RecursiveGroup(name='a')
+ a1 = RecursiveGroup(name='a1')
+ a.addRecursiveGroup(a1)
+ a2 = RecursiveGroup(name='a2')
+ a.addRecursiveGroup(a2)
+
+ assert sorted(a.subgroups, key=lambda x: x.name) == [a1, a2]
http://sourceforge.net/p/sqlobject/sqlobject/ci/0ecd7da093be2152e2da955004bd66003e3dad8f
commit 0ecd7da093be2152e2da955004bd66003e3dad8f
Author: Oleg Broytman <ph...@ph...>
Date: Sat Jul 29 00:08:16 2023 +0300
Feat(SQLBuilder): Add detailed error message
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index 22118ff..f998c0a 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -480,7 +480,8 @@ class Table(SQLExpression):
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
return self.FieldClass(self.tableName, attr)
def __sqlrepr__(self, db):
@@ -502,7 +503,8 @@ class SQLObjectTable(Table):
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
if attr == 'id':
return self._getattrFromID(attr)
elif attr in self.soClass.sqlmeta.columns:
@@ -565,14 +567,16 @@ class TableSpace:
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
return self.TableClass(attr)
class ConstantSpace:
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
return SQLConstant(attr)
@@ -628,7 +632,8 @@ class AliasTable(Table):
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
if self.table:
attr = getattr(self.table.q, attr).fieldName
return self.FieldClass(self.tableName, attr, self.alias, self)
@@ -645,7 +650,8 @@ class AliasSQLMeta():
def __getattr__(self, attr):
if attr.startswith('__'):
- raise AttributeError
+ raise AttributeError("Attribute '%s' is forbidden in '%s'" % (
+ attr, self.__class__.__name__))
table = self.__table
if (attr == "table"):
return '%s %s' % (table.sqlmeta.table, self.__alias)
http://sourceforge.net/p/sqlobject/sqlobject/ci/79294e3d5d6f2d728093a873265d035496c9349f
commit 79294e3d5d6f2d728093a873265d035496c9349f
Author: Oleg Broytman <ph...@ph...>
Date: Fri Jul 28 23:38:37 2023 +0300
Feat(SQLBuilder): Add method `Alias.select()`
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 0040aed..3d251d9 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -21,6 +21,11 @@ What's new in SQLObject
Contributors for this release are
+Minor features
+--------------
+
+* Class ``Alias`` grows a method ``.select()`` to match ``SQLObject.select()``.
+
For a more complete list, please see the news:
http://sqlobject.org/News.html
diff --git a/docs/News.rst b/docs/News.rst
index 507a370..9a0a05a 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -8,6 +8,11 @@ News
SQLObject (master)
==================
+Minor features
+--------------
+
+* Class ``Alias`` grows a method ``.select()`` to match ``SQLObject.select()``.
+
CI
--
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index 9eabcf5..22118ff 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -638,16 +638,54 @@ class AliasTable(Table):
self.alias)
+class AliasSQLMeta():
+ def __init__(self, table, alias):
+ self.__table = table
+ self.__alias = alias
+
+ def __getattr__(self, attr):
+ if attr.startswith('__'):
+ raise AttributeError
... 56 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|