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 2dddc9e4d9421f1b4dc8f438c96cdd24567a4864 (commit)
via ee9624c5f76e5458876cd624fae9010ac4ad32b4 (commit)
via a0459c0f93bdd0bda61a172ed8e717e2a239b7d2 (commit)
via c830a55eb4bb55521b5393acfac099c4c6e110c0 (commit)
via b29ab6e30703a0458a72e01262ff903e539356c5 (commit)
via 391d4b180bd8493bc75cec97cf0b972586c74fcc (commit)
via 99e0d142b7d00f3f3232aa9ce21de1a764117dba (commit)
via d07860bdf349573c993da82f5b154f7e67dbd1d6 (commit)
via 15bda4c25923597b0371b5af50d42c4db78fb206 (commit)
from 25e4fac9844618f54fdb3ecf8cf3114071b7ecf8 (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/2dddc9e4d9421f1b4dc8f438c96cdd24567a4864
commit 2dddc9e4d9421f1b4dc8f438c96cdd24567a4864
Author: Oleg Broytman <ph...@ph...>
Date: Sat Nov 4 14:54:29 2023 +0300
Build: Prepare for the next release
[skip ci]
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 9677b85..d29e875 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -1,28 +1,26 @@
Hello!
+I'm pleased to announce version 3.11.0a1, the first alpha of the upcoming
+release of branch 3.11 of SQLObject.
+
+I'm pleased to announce version 3.11.0a2, the second alpha of the upcoming
+release of branch 3.11 of SQLObject.
+
I'm pleased to announce version 3.11.0b1, the first beta of the upcoming
release of branch 3.11 of SQLObject.
+I'm pleased to announce version 3.11.0rc1, the first release candidate
+of the upcoming release of branch 3.11 of SQLObject.
-What's new in SQLObject
-=======================
+I'm pleased to announce version 3.11.0, the fourth bugfix release of branch
+3.11 of SQLObject.
-Features
---------
-* Continue working on ``SQLRelatedJoin`` aliasing introduced in 3.10.2.
- When a table joins with itself calling
- ``relJoinCol.filter(thisClass.q.column)`` raises ``ValueError``
- hinting that an alias is required for filtering.
+What's new in SQLObject
+=======================
-* Test that ``idType`` is either ``int`` or ``str``.
+The contributors for this release are ... Thanks!
-* Added ``sqlmeta.idSize``. This sets the size of integer column ``id``
- for MySQL and PostgreSQL. Allowed values are ``'TINY'``, ``'SMALL'``,
- ``'MEDIUM'``, ``'BIG'``, ``None``; default is ``None``. For Postgres
- mapped to ``smallserial``/``serial``/``bigserial``. For other backends
- it's currently ignored. Feature request by Meet Gujrathi at
- https://stackoverflow.com/q/77360075/7976758
For a more complete list, please see the news:
http://sqlobject.org/News.html
@@ -54,7 +52,7 @@ Site:
http://sqlobject.org
Download:
-https://pypi.org/project/SQLObject/3.11.0b1
+https://pypi.org/project/SQLObject/3.11.0a0.dev20231105/
News and changes:
http://sqlobject.org/News.html
http://sourceforge.net/p/sqlobject/sqlobject/ci/ee9624c5f76e5458876cd624fae9010ac4ad32b4
commit ee9624c5f76e5458876cd624fae9010ac4ad32b4
Author: Oleg Broytman <ph...@ph...>
Date: Sat Nov 4 14:45:56 2023 +0300
Release 3.11.0b1
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index c2d4289..9677b85 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -1,26 +1,28 @@
Hello!
-I'm pleased to announce version 3.10.4a1, the first alpha of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.4a2, the second alpha of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.4b1, the first beta of the upcoming
-release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.4rc1, the first release candidate
-of the upcoming release of branch 3.10 of SQLObject.
-
-I'm pleased to announce version 3.10.4, the fourth bugfix release of branch
-3.10 of SQLObject.
+I'm pleased to announce version 3.11.0b1, the first beta of the upcoming
+release of branch 3.11 of SQLObject.
What's new in SQLObject
=======================
-The contributors for this release are ... Thanks!
+Features
+--------
+
+* Continue working on ``SQLRelatedJoin`` aliasing introduced in 3.10.2.
+ When a table joins with itself calling
+ ``relJoinCol.filter(thisClass.q.column)`` raises ``ValueError``
+ hinting that an alias is required for filtering.
+
+* Test that ``idType`` is either ``int`` or ``str``.
+* Added ``sqlmeta.idSize``. This sets the size of integer column ``id``
+ for MySQL and PostgreSQL. Allowed values are ``'TINY'``, ``'SMALL'``,
+ ``'MEDIUM'``, ``'BIG'``, ``None``; default is ``None``. For Postgres
+ mapped to ``smallserial``/``serial``/``bigserial``. For other backends
+ it's currently ignored. Feature request by Meet Gujrathi at
+ https://stackoverflow.com/q/77360075/7976758
For a more complete list, please see the news:
http://sqlobject.org/News.html
@@ -52,7 +54,7 @@ Site:
http://sqlobject.org
Download:
-https://pypi.org/project/SQLObject/3.10.4a0.dev20231025/
+https://pypi.org/project/SQLObject/3.11.0b1
News and changes:
http://sqlobject.org/News.html
diff --git a/README.rst b/README.rst
index e6db9d4..1ac14c4 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-SQLObject 3.10.4a0
+SQLObject 3.11.0b1
==================
SQLObject is a free and open-source (LGPL) Python object-relational
diff --git a/setup.py b/setup.py
index b1dea83..cf98bf0 100755
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,7 @@ and `GitHub <https://github.com/sqlobject>`_.
""", # noqa: E501 line too long
long_description_content_type="text/x-rst",
classifiers=[
- "Development Status :: 5 - Production/Stable",
+ "Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: "
"GNU Library or Lesser General Public License (LGPL)",
diff --git a/sqlobject/__version__.py b/sqlobject/__version__.py
index c1c41ab..eb59522 100644
--- a/sqlobject/__version__.py
+++ b/sqlobject/__version__.py
@@ -1,8 +1,8 @@
-version = '3.10.3'
+version = '3.11.0b1'
major = 3
-minor = 10
-micro = 3
-release_level = 'final'
-serial = 0
+minor = 11
+micro = 0
+release_level = 'beta'
+serial = 1
version_info = (major, minor, micro, release_level, serial)
http://sourceforge.net/p/sqlobject/sqlobject/ci/a0459c0f93bdd0bda61a172ed8e717e2a239b7d2
commit a0459c0f93bdd0bda61a172ed8e717e2a239b7d2
Author: Oleg Broytman <ph...@ph...>
Date: Sun Oct 29 15:16:52 2023 +0300
Feat: `sqlmeta.idSize` to set `id` size
diff --git a/docs/News.rst b/docs/News.rst
index 66bc112..d644a2d 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -18,6 +18,13 @@ Features
* Test that ``idType`` is either ``int`` or ``str``.
+* Added ``sqlmeta.idSize``. This sets the size of integer column ``id``
+ for MySQL and PostgreSQL. Allowed values are ``'TINY'``, ``'SMALL'``,
+ ``'MEDIUM'``, ``'BIG'``, ``None``; default is ``None``. For Postgres
+ mapped to ``smallserial``/``serial``/``bigserial``. For other backends
+ it's currently ignored. Feature request by Meet Gujrathi at
+ https://stackoverflow.com/q/77360075/7976758
+
SQLObject 3.10.3
================
diff --git a/docs/SQLObject.rst b/docs/SQLObject.rst
index e2350d7..e67aea2 100644
--- a/docs/SQLObject.rst
+++ b/docs/SQLObject.rst
@@ -768,6 +768,13 @@ values are:
or ``str``. This is ``int`` by default (all IDs are normalized to
integers).
+`idSize`:
+ This sets the size of integer column ``id`` for MySQL and PostgreSQL.
+ Allowed values are ``'TINY'``, ``'SMALL'``, ``'MEDIUM'``, ``'BIG'``,
+ ``None``; default is ``None``. For Postgres mapped to
+ ``smallserial``/``serial``/``bigserial``. For other backends it's
+ currently ignored.
+
`style`:
A style object -- this object allows you to use other algorithms
for translating between Python attribute and class names, and the
diff --git a/sqlobject/main.py b/sqlobject/main.py
index c0f8a88..7d2fd1c 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -190,6 +190,7 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
table = None
idName = None
+ idSize = None # Allowed values are 'TINY/SMALL/MEDIUM/BIG/None'
idSequence = None
# This function is used to coerce IDs into the proper format,
# so you should replace it with str, or another function, if you
@@ -271,6 +272,10 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
if cls.idType not in (int, str):
raise TypeError('sqlmeta.idType must be int or str, not %r'
% cls.idType)
+ if cls.idSize not in ('TINY', 'SMALL', 'MEDIUM', 'BIG', None):
+ raise ValueError(
+ "sqlmeta.idType must be 'TINY', 'SMALL', 'MEDIUM', 'BIG' "
+ "or None, not %r" % cls.idSize)
cls.soClass = soClass
if not cls.style:
cls.style = styles.defaultStyle
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index b1ab6c2..1fcf0a7 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -364,7 +364,16 @@ class MySQLConnection(DBAPI):
if soClass.sqlmeta.idType is not int:
raise TypeError('sqlmeta.idType must be int or str, not %r'
% soClass.sqlmeta.idType)
- return '%s INT PRIMARY KEY AUTO_INCREMENT' % soClass.sqlmeta.idName
+ if soClass.sqlmeta.idSize is None:
+ mysql_int_type = 'INT'
+ elif soClass.sqlmeta.idSize in ('TINY', 'SMALL', 'MEDIUM', 'BIG'):
+ mysql_int_type = '%sINT' % soClass.sqlmeta.idSize
+ else:
+ raise ValueError(
+ "sqlmeta.idSize must be 'TINY', 'SMALL', 'MEDIUM', 'BIG' "
+ "or None, not %r" % soClass.sqlmeta.idSize)
+ return '%s %s PRIMARY KEY AUTO_INCREMENT' \
+ % (soClass.sqlmeta.idName, mysql_int_type)
def joinSQLType(self, join):
return 'INT NOT NULL'
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index 722f3d4..5bc6778 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -341,7 +341,22 @@ class PostgresConnection(DBAPI):
return index.postgresCreateIndexSQL(soClass)
def createIDColumn(self, soClass):
- key_type = {int: "SERIAL", str: "TEXT"}[soClass.sqlmeta.idType]
+ if soClass.sqlmeta.idType is int:
+ if soClass.sqlmeta.idSize in ('TINY', 'SMALL'):
+ key_type = 'SMALLSERIAL'
+ elif soClass.sqlmeta.idSize in ('MEDIUM', None):
+ key_type = 'SERIAL'
+ elif soClass.sqlmeta.idSize == 'BIG':
+ key_type = 'BIGSERIAL'
+ else:
+ raise ValueError(
+ "sqlmeta.idSize must be 'TINY', 'SMALL', 'MEDIUM', 'BIG' "
+ "or None, not %r" % soClass.sqlmeta.idSize)
+ elif soClass.sqlmeta.idType is str:
+ key_type = "TEXT"
+ else:
+ raise TypeError('sqlmeta.idType must be int or str, not %r'
+ % soClass.sqlmeta.idType)
return '%s %s PRIMARY KEY' % (soClass.sqlmeta.idName, key_type)
def dropTable(self, tableName, cascade=False):
diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py
index 12dff99..361bf93 100644
--- a/sqlobject/tests/test_basic.py
+++ b/sqlobject/tests/test_basic.py
@@ -347,3 +347,13 @@ def _test_wrong_sqlmeta_idType():
def test_wrong_sqlmeta_idType():
pytest.raises(TypeError, _test_wrong_sqlmeta_idType)
+
+
+def _test_wrong_sqlmeta_idSize():
+ class SOTestSO14(SQLObject):
+ class sqlmeta:
+ idSize = 'DEFAULT'
+
+
+def test_wrong_sqlmeta_idSize():
+ pytest.raises(ValueError, _test_wrong_sqlmeta_idSize)
diff --git a/sqlobject/tests/test_mysql.py b/sqlobject/tests/test_mysql.py
index 5f41bd9..5a15aca 100644
--- a/sqlobject/tests/test_mysql.py
+++ b/sqlobject/tests/test_mysql.py
@@ -38,3 +38,13 @@ def test_ANY():
SOTestANY(value=30)
assert len(list(SOTestANY.select(
SOTestANY.q.value > ANY(Select([SOTestANY.q.value]))))) == 2
+
+
+class SOTestMySQLidSize(SQLObject):
+ class sqlmeta:
+ idSize = 'BIG'
+
+
+def test_idSize():
+ assert 'id BIGINT PRIMARY KEY AUTO_INCREMENT' \
+ in SOTestMySQLidSize.createTableSQL(connection=connection)[0]
diff --git a/sqlobject/tests/test_postgres.py b/sqlobject/tests/test_postgres.py
index dbe62c0..037a78a 100644
--- a/sqlobject/tests/test_postgres.py
+++ b/sqlobject/tests/test_postgres.py
@@ -70,3 +70,13 @@ def test_SOME():
SOTestSOME(value=30)
assert len(list(SOTestSOME.select(
SOTestSOME.q.value > SOME(Select([SOTestSOME.q.value]))))) == 2
+
+
+class SOTestPgidSize(SQLObject):
+ class sqlmeta:
+ idSize = 'BIG'
+
+
+def test_idSize():
+ assert 'id BIGSERIAL PRIMARY KEY' \
+ in SOTestPgidSize.createTableSQL(connection=connection)[0]
http://sourceforge.net/p/sqlobject/sqlobject/ci/c830a55eb4bb55521b5393acfac099c4c6e110c0
commit c830a55eb4bb55521b5393acfac099c4c6e110c0
Author: Oleg Broytman <ph...@ph...>
Date: Sun Oct 29 14:35:24 2023 +0300
Feat: `idType` must be either `int` or `str`
diff --git a/docs/News.rst b/docs/News.rst
index 20213a3..66bc112 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -16,6 +16,8 @@ Features
``relJoinCol.filter(thisClass.q.column)`` raises ``ValueError``
hinting that an alias is required for filtering.
+* Test that ``idType`` is either ``int`` or ``str``.
+
SQLObject 3.10.3
================
diff --git a/docs/SQLObject.rst b/docs/SQLObject.rst
index cba7db1..e2350d7 100644
--- a/docs/SQLObject.rst
+++ b/docs/SQLObject.rst
@@ -764,8 +764,9 @@ values are:
is ``id``.
`idType`:
- A function that coerces/normalizes IDs when setting IDs. This
- is ``int`` by default (all IDs are normalized to integers).
+ A type that coerces/normalizes IDs when setting IDs. Must be ``int``
+ or ``str``. This is ``int`` by default (all IDs are normalized to
+ integers).
`style`:
A style object -- this object allows you to use other algorithms
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 827db2c..c0f8a88 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -268,6 +268,9 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
@classmethod
def setClass(cls, soClass):
+ if cls.idType not in (int, str):
+ raise TypeError('sqlmeta.idType must be int or str, not %r'
+ % cls.idType)
cls.soClass = soClass
if not cls.style:
cls.style = styles.defaultStyle
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index 76b1172..b1ab6c2 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -359,8 +359,11 @@ class MySQLConnection(DBAPI):
return index.mysqlCreateIndexSQL(soClass)
def createIDColumn(self, soClass):
- if soClass.sqlmeta.idType == str:
+ if soClass.sqlmeta.idType is str:
return '%s TEXT PRIMARY KEY' % soClass.sqlmeta.idName
+ if soClass.sqlmeta.idType is not int:
+ raise TypeError('sqlmeta.idType must be int or str, not %r'
+ % soClass.sqlmeta.idType)
return '%s INT PRIMARY KEY AUTO_INCREMENT' % soClass.sqlmeta.idName
def joinSQLType(self, join):
diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py
index 6285c44..d6df5c5 100644
--- a/sqlobject/sqlite/sqliteconnection.py
+++ b/sqlobject/sqlite/sqliteconnection.py
@@ -311,8 +311,11 @@ class SQLiteConnection(DBAPI):
return self._createIDColumn(soClass.sqlmeta)
def _createIDColumn(self, sqlmeta):
- if sqlmeta.idType == str:
+ if sqlmeta.idType is str:
return '%s TEXT PRIMARY KEY' % sqlmeta.idName
+ if sqlmeta.idType is not int:
+ raise TypeError('sqlmeta.idType must be int or str, not %r'
+ % sqlmeta.idType)
return '%s INTEGER PRIMARY KEY AUTOINCREMENT' % sqlmeta.idName
def joinSQLType(self, join):
diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py
index d9d1a2e..12dff99 100644
--- a/sqlobject/tests/test_basic.py
+++ b/sqlobject/tests/test_basic.py
@@ -337,3 +337,13 @@ def test_connection_override():
assert SOTestSO13._connection.uri() == 'sqlite:///db2'
del sqlhub.processConnection
+
+
+def _test_wrong_sqlmeta_idType():
+ class SOTestSO13(SQLObject):
+ class sqlmeta:
+ idType = dict
+
+
+def test_wrong_sqlmeta_idType():
+ pytest.raises(TypeError, _test_wrong_sqlmeta_idType)
http://sourceforge.net/p/sqlobject/sqlobject/ci/b29ab6e30703a0458a72e01262ff903e539356c5
commit b29ab6e30703a0458a72e01262ff903e539356c5
Author: Oleg Broytman <ph...@ph...>
Date: Sat Oct 28 16:39:25 2023 +0300
Feat(SOSQLRelatedJoin): Raise error for filter without alias
Closes: #187.
diff --git a/docs/News.rst b/docs/News.rst
index c6a01e4..20213a3 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -8,6 +8,14 @@ News
SQLObject (master)
==================
+Features
+--------
+
+* Continue working on ``SQLRelatedJoin`` aliasing introduced in 3.10.2.
+ When a table joins with itself calling
+ ``relJoinCol.filter(thisClass.q.column)`` raises ``ValueError``
+ hinting that an alias is required for filtering.
+
SQLObject 3.10.3
================
diff --git a/sqlobject/joins.py b/sqlobject/joins.py
index de479e7..948d04d 100644
--- a/sqlobject/joins.py
+++ b/sqlobject/joins.py
@@ -2,6 +2,7 @@ from itertools import count
from . import boundattributes
... 251 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|