sqlalchemy-tickets Mailing List for SQLAlchemy (Page 37)
Brought to you by:
zzzeek
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(174) |
Apr
(50) |
May
(71) |
Jun
(129) |
Jul
(113) |
Aug
(141) |
Sep
(82) |
Oct
(142) |
Nov
(97) |
Dec
(72) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(159) |
Feb
(213) |
Mar
(156) |
Apr
(151) |
May
(58) |
Jun
(166) |
Jul
(296) |
Aug
(198) |
Sep
(89) |
Oct
(133) |
Nov
(150) |
Dec
(122) |
| 2008 |
Jan
(144) |
Feb
(65) |
Mar
(71) |
Apr
(69) |
May
(143) |
Jun
(111) |
Jul
(113) |
Aug
(159) |
Sep
(81) |
Oct
(135) |
Nov
(107) |
Dec
(200) |
| 2009 |
Jan
(168) |
Feb
(109) |
Mar
(141) |
Apr
(128) |
May
(119) |
Jun
(132) |
Jul
(136) |
Aug
(154) |
Sep
(151) |
Oct
(181) |
Nov
(223) |
Dec
(169) |
| 2010 |
Jan
(103) |
Feb
(209) |
Mar
(201) |
Apr
(183) |
May
(134) |
Jun
(113) |
Jul
(110) |
Aug
(159) |
Sep
(138) |
Oct
(96) |
Nov
(116) |
Dec
(94) |
| 2011 |
Jan
(97) |
Feb
(188) |
Mar
(157) |
Apr
(158) |
May
(118) |
Jun
(102) |
Jul
(137) |
Aug
(113) |
Sep
(104) |
Oct
(108) |
Nov
(91) |
Dec
(162) |
| 2012 |
Jan
(189) |
Feb
(136) |
Mar
(153) |
Apr
(142) |
May
(90) |
Jun
(141) |
Jul
(67) |
Aug
(77) |
Sep
(113) |
Oct
(68) |
Nov
(101) |
Dec
(122) |
| 2013 |
Jan
(60) |
Feb
(77) |
Mar
(77) |
Apr
(129) |
May
(189) |
Jun
(155) |
Jul
(106) |
Aug
(123) |
Sep
(53) |
Oct
(142) |
Nov
(78) |
Dec
(102) |
| 2014 |
Jan
(143) |
Feb
(93) |
Mar
(35) |
Apr
(26) |
May
(27) |
Jun
(41) |
Jul
(45) |
Aug
(27) |
Sep
(37) |
Oct
(24) |
Nov
(22) |
Dec
(20) |
| 2015 |
Jan
(17) |
Feb
(15) |
Mar
(34) |
Apr
(55) |
May
(33) |
Jun
(31) |
Jul
(27) |
Aug
(17) |
Sep
(22) |
Oct
(26) |
Nov
(27) |
Dec
(22) |
| 2016 |
Jan
(20) |
Feb
(24) |
Mar
(23) |
Apr
(13) |
May
(17) |
Jun
(14) |
Jul
(31) |
Aug
(23) |
Sep
(24) |
Oct
(31) |
Nov
(23) |
Dec
(16) |
| 2017 |
Jan
(24) |
Feb
(20) |
Mar
(27) |
Apr
(24) |
May
(28) |
Jun
(18) |
Jul
(18) |
Aug
(23) |
Sep
(30) |
Oct
(17) |
Nov
(12) |
Dec
(12) |
| 2018 |
Jan
(27) |
Feb
(23) |
Mar
(13) |
Apr
(19) |
May
(21) |
Jun
(29) |
Jul
(11) |
Aug
(22) |
Sep
(14) |
Oct
(9) |
Nov
(24) |
Dec
|
|
From: Wichert A. <iss...@bi...> - 2015-05-24 19:29:11
|
New issue 3432: Can't use postgresql_ops for expressions https://bitbucket.org/zzzeek/sqlalchemy/issue/3432/cant-use-postgresql_ops-for-expressions Wichert Akkerman: I need to build a trigram index for a set of columns in PostgreSQL. The SQL statement looks like this: ```sql CREATE INDEX trgm_idx ON my_table USING gist (language, (coalesce(col1, '') || ' ' || coalesce(col2, '')) gist_trgm_ops); ``` My attempt to do this using SQLAlchemy looks like this: ```python schema.Index('trgm_idx', Mytable.language, (func.coalesce(Mytable.col1, '') + ' ' + func.coalesce(MyTable.col2, '')).label('foo'), postgresql_ops={ 'foo': 'pg_trgm', }, postgresql_using='gist') ``` I use `label()` just to get a key I can pass to `postgresql_ops`. Unfortunately this does not work. This is the generated SQL: ``` CREATE INDEX trgm_idx ON my_table USING gist (language, (coalesce(col1, '') || ' ' || coalesce(col2, ''))) ``` |
|
From: Mike B. <iss...@bi...> - 2015-05-24 01:00:07
|
New issue 3431: object eager loaded via two separate paths, approach for "existing" row https://bitbucket.org/zzzeek/sqlalchemy/issue/3431/object-eager-loaded-via-two-separate-paths Mike Bayer: test: ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) b_id = Column(ForeignKey('b.id')) c_id = Column(ForeignKey('c.id')) b = relationship("B") c = relationship("C") class B(Base): __tablename__ = 'b' id = Column(Integer, primary_key=True) c_id = Column(ForeignKey('c.id')) c = relationship("C") class C(Base): __tablename__ = 'c' id = Column(Integer, primary_key=True) d_id = Column(ForeignKey('d.id')) d = relationship("D") class D(Base): __tablename__ = 'd' id = Column(Integer, primary_key=True) e = create_engine("sqlite://", echo=True) Base.metadata.create_all(e) s = Session(e) c = C(d=D()) s.add( A(b=B(c=c), c=c) ) s.commit() c_alias_1 = aliased(C) c_alias_2 = aliased(C) q = s.query(A) q = q.join(A.b).join(c_alias_1, B.c).join(c_alias_1.d) q = q.options(contains_eager(A.b).contains_eager(B.c, alias=c_alias_1).contains_eager(C.d)) q = q.join(c_alias_2, A.c) q = q.options(contains_eager(A.c, alias=c_alias_2)) a1 = q.all()[0] assert 'd' in a1.c.__dict__ ``` this test relies on the order in which we load attributes, and for some reason PYTHONHASHSEED isn't doing the job in all cases, so test with this patch: ``` #!diff diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index 50afaf6..8de66de 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -295,6 +295,13 @@ def _instance_processor( quick_populators = path.get( context.attributes, "memoized_setups", _none_set) + import random + props = list(props) + random.shuffle(props) + + print( + "PROPS!!!!",[p.key for p in props] + ) for prop in props: if prop in quick_populators: ``` there's no way to force this loader to happen in all cases because ultimately when the C object is already there, the "isnew" flag is not set and we naturally hit the "existing" loader. However, the "existing" loader *can* do a check here and populate the key, and we are checking anyway: ``` #!diff diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 78e9293..dff51b9 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -1559,13 +1559,15 @@ class JoinedLoader(AbstractRelationshipLoader): # call _instance on the row, even though the object has # been created, so that we further descend into properties existing = _instance(row) - if existing is not None \ - and key in dict_ \ - and existing is not dict_[key]: - util.warn( - "Multiple rows returned with " - "uselist=False for eagerly-loaded attribute '%s' " - % self) + if existing is not None: + if key in dict_: + if existing is not dict_[key]: + util.warn( + "Multiple rows returned with " + "uselist=False for eagerly-loaded attribute '%s' " + % self) + else: + dict_[key] = existing def load_scalar_from_joined_exec(state, dict_, row): _instance(row) # this is an inlined path just for column-based attributes. ``` would need to do the deep thinking here to see if this is right. |
|
From: saltycrane <iss...@bi...> - 2015-05-22 02:55:49
|
New issue 3430: MSSQL - Missing NOLOCK hint when using a Table with a schema https://bitbucket.org/zzzeek/sqlalchemy/issue/3430/mssql-missing-nolock-hint-when-using-a saltycrane: Using mssql, I don't see the NOLOCK hint in the generated SQL of my `select` query when I specify a `schema` in my `Table`. (I do see the hint if I don't specify a schema.) Here is a test case: # -*- encoding: utf-8 from sqlalchemy import * from sqlalchemy.databases import mssql from sqlalchemy.testing import fixtures, AssertsCompiledSQL class CompileTest(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = mssql.dialect() def test_select_without_schema_with_nolock(self): metadata = MetaData() t = Table( 'sometable', metadata, Column('somecolumn', Integer), ) self.assert_compile(select([t]).with_hint(t, "WITH (NOLOCK)"), 'SELECT sometable.somecolumn ' 'FROM sometable WITH (NOLOCK)') def test_select_with_schema_with_nolock(self): metadata = MetaData() t = Table( 'sometable', metadata, Column('somecolumn', Integer), schema='dlr', ) self.assert_compile(select([t]).with_hint(t, "WITH (NOLOCK)"), 'SELECT sometable_1.somecolumn ' 'FROM dlr.sometable AS sometable_1 WITH (NOLOCK)') Here is the console output when I run it with sqlalchemy master branch (commit 525cc6fe0247a76201c173e535d8309333461afc). The first tests passes but the second test fails. $ py.test test/test_mssql_schema_nolock.py ============================================================= test session starts ============================================================== platform linux2 -- Python 2.7.8 -- py-1.4.27 -- pytest-2.7.1 -- /home/eliot/src/bb/sqlalchemy/venv/bin/python rootdir: /home/eliot/src/bb/sqlalchemy, inifile: setup.cfg collected 2 items test/test_mssql_schema_nolock.py::CompileTest::test_select_with_schema_with_nolock FAILED test/test_mssql_schema_nolock.py::CompileTest::test_select_without_schema_with_nolock PASSED =================================================================== FAILURES =================================================================== _______________________________________________ CompileTest.test_select_with_schema_with_nolock ________________________________________________ Traceback (most recent call last): File "/home/eliot/src/bb/sqlalchemy/test/test_mssql_schema_nolock.py", line 28, in test_select_with_schema_with_nolock 'SELECT sometable_1.somecolumn ' File "/home/eliot/src/bb/sqlalchemy/test/../lib/sqlalchemy/testing/assertions.py", line 314, in assert_compile eq_(cc, result, "%r != %r on dialect %r" % (cc, result, dialect)) File "/home/eliot/src/bb/sqlalchemy/test/../lib/sqlalchemy/testing/assertions.py", line 211, in eq_ assert a == b, msg or "%r != %r" % (a, b) AssertionError: u'SELECT sometable_1.somecolumn FROM dlr.sometable AS sometable_1' != 'SELECT sometable_1.somecolumn FROM dlr.sometable AS sometable_1 WITH (NOLOCK)' on dialect <sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc object at 0x7f09c573b590> ------------------------------------------------------------- Captured stdout call ------------------------------------------------------------- SQL String: SELECT sometable_1.somecolumn FROM dlr.sometable AS sometable_1{} =========================================================== short test summary info ============================================================ FAIL test/test_mssql_schema_nolock.py::CompileTest::()::test_select_with_schema_with_nolock ====================================================== 1 failed, 1 passed in 0.07 seconds ====================================================== Is this a bug or is my usage incorrect? ### Real life usage ### I don't think the following information is needed, but here are notes about my real life usage. I can provide further details if it is required. - I am using the ORM and Flask-SQLAlchemy: class User(db.Model): __tablename__ = 'User' __table_args__ = ( {'schema': 'dlr'}, ) user_id = db.Column( 'UserId', db.BigInteger, nullable=False, primary_key=True, autoincrement=False) db.session.query(User).with_hint(User, 'WITH (NOLOCK)').order_by(User.user_id).all() - SQLAlchemy==1.0.4, Flask-SQLAlchemy==2.0, pyodbc==3.0.5 - My laptop: Ubuntu 14.10 - Database: SQL Server ?2008 I think? |
|
From: Stefan U. <iss...@bi...> - 2015-05-21 21:53:17
|
New issue 3429: Support for GROUP BY CUBE, SET, ROLLUP https://bitbucket.org/zzzeek/sqlalchemy/issue/3429/support-for-group-by-cube-set-rollup Stefan Urbanek: Postgres 9.5 is coming with a new [GROUP BY summarizing features](https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.5#GROUPING_SETS.2C_CUBE_and_ROLLUP). Other dialect providing this feature is, for example, [Oracle](http://docs.oracle.com/cd/B19306_01/server.102/b14223/aggreg.htm#i1007428). It is quite useful feature in data warehouse environment. The SQLAlchemy might either provide `group_by_*()` function for each of the group by types or have an additional argument in the `group_by()` function. The signature might look like: `group_by(*clauses, grouping=None)` where grouping might be `None`, `"cube"`, `"rollup"` or `"sets"`. |
|
From: Priit L. <iss...@bi...> - 2015-05-21 15:22:20
|
New issue 3428: Warning about unresolved label when passing argument via text() to order_by https://bitbucket.org/zzzeek/sqlalchemy/issue/3428/warning-about-unresolved-label-when Priit Laes: When passing following argument to order_by as `text('(count=0)')`, sqlalchemy-1.0.4 emits following warning. This seems to be a regression from 0.9 series. ``` #!python sqlalchemy/sql/compiler.py:572: SAWarning: Can't resolve label reference '(stock = 0)'; converting to text() (this warning may be suppressed after 10 occurrences) ``` The order clause itself looks like this (`stock` and `price` come via labelled columns from joined tables): `.order_by(Product.id, '(stock = 0)', 'price', Warehouse.min_days)` I have yet to extract a nice self-contained testcase for SQLAlchemy, but here's an example SQLFiddle http://sqlfiddle.com/#!15/fbfe4/5 which showcases the way I use the '(stock = 0)' as an argument to order_by. |
|
From: Raphaël S. <iss...@bi...> - 2015-05-21 13:26:34
|
New issue 3427: SQLAlchemy 1.0 behavior difference regarding column default handling https://bitbucket.org/zzzeek/sqlalchemy/issue/3427/sqlalchemy-10-behavior-difference Raphaël Slinckx: Here is a test case yielding different results between sqlalchemy 0.9.9 and 1.0+ ```python import json from sqlalchemy import create_engine, Column from sqlalchemy.types import TypeDecorator, UnicodeText, Integer from sqlalchemy.ext.mutable import MutableDict from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session class JSONDictType(TypeDecorator): impl = UnicodeText def process_bind_param(self, value, dialect): if value is not None: value = unicode(json.dumps(value)) return value def process_result_value(self, value, dialect): if value is not None: value = json.loads(value) return value def JSON(): return MutableDict.as_mutable(JSONDictType) Base = declarative_base() class MyDataClass(Base): __tablename__ = 'my_data' id = Column(Integer, primary_key=True) data = Column(JSON(), default={}, nullable=False) session = Session(create_engine("sqlite:///:memory:", echo=True)) Base.metadata.create_all(session.bind) m1 = MyDataClass() session.add(m1) session.flush() # Note: without this, the m1.data is None on sqlalchemy 1.0 m1.data["test"] = 1 session.commit() m2 = MyDataClass() session.add(m2) session.commit() assert m1.data == {'test': 1} assert m2.data == {} # With sqlalchemy 1.0 this results in # m1.data == {} # m2.data == {'test': 1} ``` As you can see the default={} seemed to work previously (also the m1.data['test'] = 1 worked without the session.flush() just above) With the latest version, the dict provided as default seems to be used and re-used resulting in a process-wide globally shared default dict which can lead to catastrophic leaks in a webapp for example. Also the object needs to be flushed before m1.data is populated. Maybe this usage was not expected or even discouraged, but I didn't find anything in the docs about this. The closest thing I identified is the change discussed here: http://docs.sqlalchemy.org/en/latest/changelog/migration_10.html#changes-to-attribute-events-and-other-operations-regarding-attributes-that-have-no-pre-existing-value and possibly the new default handling. What is the expected behavior as of 1.0 ? And how do I get the old behavior using the latest version ? Responsible: zzzeek |
|
From: zifot <iss...@bi...> - 2015-05-20 14:45:01
|
New issue 3426: Object not added to a session after assigned to a scalar part of a relationship if backref is missing https://bitbucket.org/zzzeek/sqlalchemy/issue/3426/object-not-added-to-a-session-after zifot: Not exactly sure if this is a bug, but certainly somewhat unexpected behavior. Both of the last two assertions in the following script fail. ``` #!python from sqlalchemy import ( create_engine, Column, Integer, ForeignKey, ) from sqlalchemy.orm import ( sessionmaker, relationship, object_session, ) from sqlalchemy.ext.declarative import declarative_base engine = create_engine('sqlite:///test.db') Session = sessionmaker(bind=engine) session = Session() Base = declarative_base() class Parent(Base): __tablename__ = 'parents' id = Column(Integer, primary_key=True) class Child1(Base): __tablename__ = 'children1' id = Column(Integer, primary_key=True) parent_id = Column(Integer, ForeignKey(Parent.id)) parent = relationship(Parent, backref='children') class Child2(Base): __tablename__ = 'children2' id = Column(Integer, primary_key=True) parent_id = Column(Integer, ForeignKey(Parent.id)) parent = relationship(Parent) # No backref defined Base.metadata.create_all(engine) parent = Parent() session.add(parent) child1a = Child1(parent=parent) child1b = Child1() child1b.parent = parent assert object_session(child1a) is session # True assert object_session(child1b) is session # True child2a = Child2(parent=parent) child2b = Child2() child2b.parent = parent assert object_session(child2a) is session # False assert object_session(child2b) is session # False ``` |
|
From: Priit L. <iss...@bi...> - 2015-05-18 15:14:12
|
New issue 3425: PGValues recipe and PostgreSQL JSONB data column https://bitbucket.org/zzzeek/sqlalchemy/issue/3425/pgvalues-recipe-and-postgresql-jsonb-data Priit Laes: I'm running into troubles with JSONB field that's updated via `UPDATE ... FROM VALUES (...)` clause. I have taken the PGValues example from wiki and added JSONB column called 'myjson' and I'm trying to update but it causes crash on both 1.0.4 and 0.9.8 ``` #!python Traceback (most recent call last): File "pgvalues.py", line 63, in <module> update(dict(mytext=t2.c.mytext, myint=t2.c.myint, myjson={'int': t2.c.myint})) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2949, in update update_op.exec_() File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1074, in exec_ self._do_exec() File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 1223, in _do_exec mapper=self.mapper) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1023, in execute bind, close_with_result=True).execute(clause, params or {}) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1078, in _execute_context None, None) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1339, in _handle_dbapi_exception exc_info File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1073, in _execute_context context = constructor(dialect, self, conn, *args) File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 590, in _init_compiled for key in compiled_params File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 590, in <genexpr> for key in compiled_params File "/home/plaes/.virtualenvs/kabushiki/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/json.py", line 211, in process return json_serializer(value).encode(encoding) File "/usr/lib64/python2.7/json/__init__.py", line 243, in dumps return _default_encoder.encode(obj) File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode return _iterencode(o, 0) File "/usr/lib64/python2.7/json/encoder.py", line 184, in default raise TypeError(repr(o) + " is not JSON serializable") sqlalchemy.exc.StatementError: (exceptions.TypeError) <sqlalchemy.sql.elements.ColumnClause at 0x7fb44a267e90; myint> is not JSON serializable [SQL: u"UPDATE mytable SET myjson=%(myjson)s, mytext=myvalues.mytext, myint=myvalues.myint FROM (VALUES (1, 'textA', 99), (2, 'textB', 88)) AS myvalues (mykey, mytext, myint) WHERE mytable.mykey = myvalues.mykey"] [parameters: [{}]] ``` |
|
From: Andrey Z. <iss...@bi...> - 2015-05-16 23:09:43
|
New issue 3424: mssql aliasing of schema-tables in update https://bitbucket.org/zzzeek/sqlalchemy/issue/3424/mssql-aliasing-of-schema-tables-in-update Andrey Zholos: When updating a table with a specified schema name, some parts of the generated statement refer to the table with an alias and some parts don't. A subquery uses an alias that was not introduced (it could be introduced in an mssql "from" clause): ``` #!sql UPDATE [schema].sometable SET val= (SELECT [#other].newval FROM [#other] WHERE sometable_1.sym = [#other].sym) ``` An alias is introduced but the "where" clause doesn't use it: ``` #!sql UPDATE [schema].sometable SET val=[#other].newval FROM [schema].sometable AS sometable_1, [#other] WHERE [schema].sometable.sym = [#other].sym ``` Both of these statements fail. Complete program attached. |
|
From: babel <iss...@bi...> - 2015-05-15 21:51:09
|
New issue 3423: AssociationProxy owning_class not set when accessed via mapper class https://bitbucket.org/zzzeek/sqlalchemy/issue/3423/associationproxy-owning_class-not-set-when babel: This is using sqlalchemy 0.9.8 Assuming a declarative class called "MyClass" with an association proxy field call "my_field" >>> ap = MyClass.__mapper__.all_orm_descriptors['my_field'] >>> ap.owning_class None >>> ap = MyClass.my_field >>> ap.owning_class <class 'MyClass'> >>> ap = MyClass.__mapper__.all_orm_descriptors['my_field'] >>> ap.owning_class <class 'MyClass'> Without the owning_class set, most of the other properties will raise exceptions when trying to access them. This can be problematic when using the mapper class to procedurally access fields via the mapper. |
|
From: Ken S. <iss...@bi...> - 2015-05-15 16:01:37
|
New issue 3422: Cant JSON serialize sqlalchemy.util.langhelpers.symbol https://bitbucket.org/zzzeek/sqlalchemy/issue/3422/cant-json-serialize Ken Sheppardson: Starting with version 0.9.0, simplejson sees util.symbol objects as integers, causing it to generate invalid JSON. We're trying to serialize stack traces and function arguments as JSON, and although we've defined a custom JSONEncoder default() method to handle non-standard data types, we're getting invalid JSON like: ``` ... "args": [ "<sqlalchemy.orm.attributes.ScalarAttributeImpl object at 0x4966090>", "<sqlalchemy.orm.state.InstanceState object at 0x52ca650>", "{'_data': {'follower_count': None, 'followers': None, 'following': None, 'locale': u'zh_hans', 'region': None, 'timezone': u'Africa/Cairo', 'utc_offset': Decimal('2.0')}, '_modified': {'locale': u'zh_hans'}, '_sa_instance_state': <sqlalchemy.orm.state.InstanceState object at 0x52ca650>, 'locale': u'zh_hans'}", symbol('PASSIVE_OFF') ], ... ``` ...because while our custom default() method handles data types simplejson doesn't recognize, it thinks "symbol('PASSIVE_OFF')" is an int, and dumps the raw value into the JSON. To reproduce (using python 2.7.6, sqlalchemy 1.0.4, simplejson 3.6.5): ``` Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sqlalchemy as sa >>> import json >>> sym = sa.util.symbol("PASSIVE_OFF") >>> data = ['str1', 123, sym] >>> print json.JSONEncoder().encode(data) ["str1", 123, symbol('PASSIVE_OFF')] >>> print sym symbol('PASSIVE_OFF') >>> type(sym) <class 'sqlalchemy.util.langhelpers.symbol'> >>> isinstance(sym,int) True ``` Python 3 handles this slightly differently: rather than "symbol('PASSIVE_OFF')" in the JSON, we see integers like -4343837943729882877 in the output of encode(). |
|
From: Andras T. <iss...@bi...> - 2015-05-15 07:36:29
|
New issue 3421: SQLAlchemy does not catch postgresql.exceptions.UniqueError https://bitbucket.org/zzzeek/sqlalchemy/issue/3421/sqlalchemy-does-not-catch Andras Tim: SQLAlchemy does not catch **postgresql.exceptions.UniqueError**. In normal case SQLAlchemy catches all exceptions and make standardized exceptions. This exception should be an **sqlalchemy.exc.IntegrityError**. |
|
From: Sebastian B. <iss...@bi...> - 2015-05-14 22:37:27
|
New issue 3420: LW KeyedTuples have instance dicts (ineffective __slots__) https://bitbucket.org/zzzeek/sqlalchemy/issue/3420/lw-keyedtuples-have-instance-dicts Sebastian Bank: ```python import sqlalchemy import sqlalchemy.orm engine = sqlalchemy.create_engine('sqlite://') session = sqlalchemy.orm.Session(engine) result = session.query(sa.func.now())[0] result.__dict__ # should raise AttributeError print('\n'.join('%s\t%s' % (getattr(cls, '__slots__', None), cls) for cls in result.__class__.mro())) # () <class 'sqlalchemy.util._collections.result'> # () <class 'sqlalchemy.util._collections._LW'> # None <class 'sqlalchemy.util._collections.AbstractKeyedTuple'> # None <type 'tuple'> # None <type 'object'> ``` Note that `__slots__` only works if [every class along the mro](https://docs.python.org/2/reference/datamodel.html#slots) spares instance `__dict__`s. `__slots__ = ()` for `sqlalchemy.util._collections.AbstractKeyedTuple` shoud fix this. |
|
From: Mike B. <iss...@bi...> - 2015-05-14 17:50:27
|
New issue 3419: connection record not immediately checked back in when connection fails after failed checkout event handler https://bitbucket.org/zzzeek/sqlalchemy/issue/3419/connection-record-not-immediately-checked Mike Bayer: ``` #!python from sqlalchemy import event import mock import sys import sqlalchemy as sa engine = sa.create_engine( "postgresql://scott:tiger@localhost/test", pool_size=1, max_overflow=0, pool_timeout=0, pool_recycle=3600) @event.listens_for(engine, 'checkout') def handle_checkout_event(dbapi_con, con_record, con_proxy): try: with dbapi_con.cursor() as cur: cur.execute("SELECT 1") cur.fetchone() except Exception: raise sa.exc.DisconnectionError() # act as though the DB is turned off conn = engine.connect() dbapi_conn = conn.connection.connection conn.close() dbapi_conn.close() def shutdown_backend(): raise dbapi_conn.OperationalError("closed the connection") patcher = mock.patch.object(engine.pool, "_creator", shutdown_backend) patcher.start() try: with engine.begin() as conn: pass except sa.exc.OperationalError as e: print >>sys.stderr, "Got an (expected) error: ", e # sys.exc_clear() try: with engine.begin() as conn: pass except sa.exc.OperationalError as e: print >>sys.stderr, "Got an (expected) error: ", e assert True ``` the pool checkout fails on the second run because the single ConnectionRecord hasn't been checked in. ``` #!diff diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 0a4cdad..b38aefb 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -732,7 +732,13 @@ class _ConnectionFairy(object): pool.logger.info( "Disconnection detected on checkout: %s", e) fairy._connection_record.invalidate(e) - fairy.connection = fairy._connection_record.get_connection() + try: + fairy.connection = \ + fairy._connection_record.get_connection() + except: + with util.safe_reraise(): + fairy._connection_record.checkin() + attempts -= 1 pool.logger.info("Reconnection attempts exhausted on checkout") ``` |
|
From: Mike B. <iss...@bi...> - 2015-05-08 16:12:01
|
New issue 3418: preserve CTE from a SELECT when doing INSERT...SELECT https://bitbucket.org/zzzeek/sqlalchemy/issue/3418/preserve-cte-from-a-select-when-doing Mike Bayer: related to #2551 but of lesser scope, if the select() passed to insert.from_select() has a cte() inside of it, we should render that inline: ``` #!sql INSERT INTO data (id, data) WITH anon_1 AS (SELECT data2.id AS id, data2.data AS data FROM data2 WHERE data2.data = 1) SELECT data2.id, data2.data FROM data2, anon_1 WHERE data2.data = anon_1.data ``` PG supports the WITH both on top and under the INSERT, and they have different semantics: http://www.postgresql.org/docs/9.4/interactive/sql-insert.html "It is possible for the query (SELECT statement) to also contain a WITH clause. In such a case both sets of with_query can be referenced within the query, but the second one takes precedence since it is more closely nested.". |
|
From: Marco M. <iss...@bi...> - 2015-05-07 22:55:34
|
New issue 3417: Unable to get column_descriptions when joining to same join target multiple times https://bitbucket.org/zzzeek/sqlalchemy/issue/3417/unable-to-get-column_descriptions-when Marco Martinez: I'm trying to get ``column_descriptions`` from a query that I'm building that contains multiple joins to the same target, but I'm getting the following error message: ``` Traceback (most recent call last): File "bug-alias.py", line 37, in test query.column_descriptions File "/home/mmartinez/env/sa/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2583, in column_descriptions for ent in self._entities File "/home/mmartinez/env/sa/lib/python2.7/site-packages/sqlalchemy/orm/util.py", line 398, in __getattr__ raise AttributeError(key) AttributeError: entity ``` Here's an example of what my code pre-1.0 was doing: ``` #!python import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.ext.declarative import declarative_base Session = orm.Session() Base = declarative_base() class User(Base): __tablename__ = 'user' id = sa.Column(sa.Integer(), primary_key=True) name = sa.Column(sa.Unicode(), nullable=False, unique=True) class MyData(Base): __tablename__ = 'mydata' id = sa.Column(sa.Integer(), primary_key=True) data = sa.Column(sa.Unicode(), nullable=False, unique=True) created_by_id = sa.Column(sa.ForeignKey(User.id)) created_by = orm.relationship(User, foreign_keys=[created_by_id]) modified_by_id = sa.Column(sa.ForeignKey(User.id)) modified_by = orm.relationship(User, foreign_keys=[modified_by_id]) Creator = orm.aliased(User) Modifier = orm.aliased(User) query = ( Session.query( MyData.data, sa.literal(u'why').label('someliteral'), # Literals will fail too Creator.name.label('created_by'), Modifier.name.label('modfied_by') ) .join(Creator, MyData.created_by) .join(Modifier, MyData.modified_by) ) print ([d['name'] for d in query.column_descriptions]) ``` Reading the 1.0 changlog, I tried this instead (which worked) : ``` #!python query = ( Session.query( MyData.data, sa.literal(u'why').label('someliteral'), ) .join(MyData.created_by, aliased=True) .add_column(User.name.label('created_by')) .reset_joinpoint() .join(MyData.modified_by, aliased=True) .add_column(User.name.label('modified_by')) .reset_joinpoint() ) print ([d['name'] for d in query.column_descriptions]) ``` Am I missing something? Thanks in advance. |
|
From: Konsta V. <iss...@bi...> - 2015-05-06 15:43:16
|
New issue 3416: Problems with unhashable types https://bitbucket.org/zzzeek/sqlalchemy/issue/3416/problems-with-unhashable-types Konsta Vesterinen: Before SA 1.0 I could have denormalized schemas where foreign keys pointed to unhashable types (let's say HSTORE). This was very common in same cases for me as I had for example denormalized translation columns using HSTORE as the underlying data type. Then foreign keys with onupdate='CASCADE' where used for automatic real-time denormalization when data changed. I created a simplified test case: ``` #!python import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.postgresql import HSTORE engine = sa.create_engine( 'postgres://postgres@localhost/sqlalchemy_utils_test' ) Base = declarative_base() Session = sessionmaker(bind=engine) session = Session() session.execute('CREATE EXTENSION IF NOT EXISTS hstore') session.commit() class Category(Base): __tablename__ = 'category' id = sa.Column(sa.Integer, primary_key=True) data = sa.Column(HSTORE) __table_args__ = ( sa.Index( 'some_index', data, id, unique=True ), ) class Article(Base): __tablename__ = 'article' id = sa.Column(sa.Integer, primary_key=True) name = sa.Column(sa.String) category_id = sa.Column(sa.Integer) category_data = sa.Column(HSTORE) category = sa.orm.relationship(Category) __table_args__ = ( sa.ForeignKeyConstraint( [category_data, category_id], ['category.data', 'category.id'], onupdate='CASCADE' ), ) Base.metadata.create_all(bind=session.bind) article = Article(name='Some article', category=Category(data={'1': '2'})) session.add(article) session.commit() category = Category(data={'2': '2'}) session.commit() article.category = category session.commit() Base.metadata.drop_all(bind=session.bind) ``` throws Exception ``` #!python ... elif orm_util._never_set.intersection(params.values()): TypeError: unhashable type: 'dict' ``` The problem is even deeper than this as the following code block illustrates: ``` #!python import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.postgresql import HSTORE engine = sa.create_engine( 'postgres://postgres@localhost/sqlalchemy_utils_test' ) Base = declarative_base() Session = sessionmaker(bind=engine) session = Session() session.execute('CREATE EXTENSION IF NOT EXISTS hstore') session.commit() class Article(Base): __tablename__ = 'article' id = sa.Column(HSTORE, primary_key=True) Base.metadata.create_all(bind=session.bind) article = Article(id={'1': '2'}) session.add(article) session.commit() Base.metadata.drop_all(bind=session.bind) ``` Which throws exception: ``` #!python Traceback (most recent call last): File "sa_test.py", line 42, in <module> session.commit() File ".../sqlalchemy/orm/session.py", line 790, in commit self.transaction.commit() File ".../sqlalchemy/orm/session.py", line 392, in commit self._prepare_impl() File ".../sqlalchemy/orm/session.py", line 372, in _prepare_impl self.session.flush() File ".../sqlalchemy/orm/session.py", line 2004, in flush self._flush(objects) File ".../sqlalchemy/orm/session.py", line 2122, in _flush transaction.rollback(_capture_exception=True) File ".../sqlalchemy/util/langhelpers.py", line 60, in __exit__ compat.reraise(exc_type, exc_value, exc_tb) File ".../sqlalchemy/util/compat.py", line 182, in reraise raise value File ".../sqlalchemy/orm/session.py", line 2086, in _flush flush_context.execute() File ".../sqlalchemy/orm/unitofwork.py", line 373, in execute rec.execute(self) File ".../sqlalchemy/orm/unitofwork.py", line 532, in execute uow File ".../sqlalchemy/orm/persistence.py", line 149, in save_obj base_mapper, states, uowtransaction File ".../sqlalchemy/orm/persistence.py", line 292, in _organize_states_for_save instance_key in uowtransaction.session.identity_map: File ".../sqlalchemy/orm/identity.py", line 96, in __contains__ if key in self._dict: TypeError: unhashable type: 'dict' ``` The second issue is not critical for me but the first is. I have many projects using HSTORE based translations and denormalization. |
|
From: Winfried P. <iss...@bi...> - 2015-05-05 20:30:56
|
New issue 3415: sqlalchemy.ext.automap.automap_base documentation error https://bitbucket.org/zzzeek/sqlalchemy/issue/3415/sqlalchemyextautomapautomap_base Winfried Plappert: In chapter [link to docu](http://docs.sqlalchemy.org/en/rel_1_0/orm/extensions/automap.html?highlight=sqlalchemy.ext.automap.automap_base#api-reference) the classmethod prepare contais some errorneous extra information: "classmethod prepare(engine=None, reflect=False, classname_for_table=<function classname_for_table at 0x7f26087aaed8>, collection_class=<type 'list'>, name_for_scalar_relationship=<function name_for_scalar_relationship at 0x7f26087ac398>, name_for_collection_relationship=<function name_for_collection_relationship at 0x7f26087ac410>, generate_relationship=<function generate_relationship at 0x7f26087ac488>)" further down in the same chapter the method sqlalchemy.ext.automap.generate_relationship contanis the parameter "direction" which is described as "direction¶ – indicate the “direction” of the relationship; this will be one of ONETOMANY, MANYTOONE, MANYTOONE." Remove one "MANYTOONE". |
|
From: iho_ <iss...@bi...> - 2015-05-04 10:41:56
|
New issue 3414: asyncio and sqlalchemy-orm https://bitbucket.org/zzzeek/sqlalchemy/issue/3414/asyncio-and-sqlalchemy-orm iho_: Hello! How about integrate it? Is it even possible? |
|
From: Konsta V. <iss...@bi...> - 2015-05-02 16:31:12
|
New issue 3413: Make new order by inspection system support hybrid properties https://bitbucket.org/zzzeek/sqlalchemy/issue/3413/make-new-order-by-inspection-system Konsta Vesterinen: First of all I love the new order by inspection (thanks Mike!). It works like a charm for column properties however I noticed that it doesn't work with hybrids. This test case illustrates the problem: ``` #!python import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.hybrid import hybrid_property engine = sa.create_engine('sqlite:///:memory:') Base = declarative_base() Session = sessionmaker(bind=engine) session = Session() class User(Base): __tablename__ = 'text_item' id = sa.Column(sa.Integer, primary_key=True) first_name = sa.Column(sa.Unicode(255)) last_name = sa.Column(sa.Unicode(255)) @hybrid_property def name(self): """User's full name.""" return u'%s %s' % (self.first_name, self.last_name) @name.expression def name(self): return sa.func.concat(self.first_name, ' ', self.last_name) print session.query(User).order_by('name') print session.query(User).order_by(User.name) ``` First query returns warning whereas I think it should return the same result as the latter query. |
|
From: Mike B. <iss...@bi...> - 2015-05-02 15:28:28
|
New issue 3412: assertion added for #3347 needs to be liberalized https://bitbucket.org/zzzeek/sqlalchemy/issue/3412/assertion-added-for-3347-needs-to-be Mike Bayer: the assertion added in #3347 was there to trap cases where something unexpected was sent here; if the joins include some inner secondaries, then we might need to unwrap further: ``` #!python # coding: utf-8 # Test case for SQLAlchemy bug, # based on https://github.com/veekun/pokedex # and https://github.com/veekun/spline-pokedex. import sqlalchemy.ext.declarative from sqlalchemy.orm import relationship, joinedload from sqlalchemy.schema import Column, ForeignKey, Table from sqlalchemy.types import Boolean, Integer, Unicode TableBase = sqlalchemy.ext.declarative.declarative_base() Session = sqlalchemy.orm.sessionmaker() class Pokemon(TableBase): __tablename__ = 'pokemon' __singlename__ = 'pokemon' id = Column(Integer, primary_key=True, nullable=False) identifier = Column(Unicode(79), nullable=False) species_id = Column(Integer, ForeignKey('pokemon_species.id')) is_default = Column(Boolean) class PokemonForm(TableBase): __tablename__ = 'pokemon_forms' __singlename__ = 'pokemon_form' id = Column(Integer, primary_key=True, nullable=False) pokemon_id = Column(Integer, ForeignKey('pokemon.id')) class PokemonSpecies(TableBase): __tablename__ = 'pokemon_species' __singlename__ = 'pokemon_species' id = Column(Integer, primary_key=True, nullable=False) form_id = Column(ForeignKey('pokemon_forms.id')) pokemon_types = Table( "pokemon_types", TableBase.metadata, Column("pokemon_id", Integer, ForeignKey('pokemon.id'), primary_key=True), Column("type_id", Integer, ForeignKey('types.id'), nullable=False) ) class Type(TableBase): __tablename__ = 'types' __singlename__ = 'type' id = Column(Integer, primary_key=True) identifier = Column(Unicode(79)) # pokemon_id = Column(ForeignKey("pokemon.id")) Pokemon.types = relationship(Type, secondary=pokemon_types, innerjoin=True, ) PokemonForm.pokemon = relationship( Pokemon, innerjoin=True) PokemonSpecies.default_form = relationship(PokemonForm) session = Session() # PokemonSpecies -> (Pokemon) -> PokemonForm -> Pokemon -> (PokemonType) -> Type q = session.query(PokemonSpecies) \ .options( joinedload('default_form'). joinedload('pokemon').joinedload('types')) print(q) ``` |
|
From: Mike B. <iss...@bi...> - 2015-05-02 12:52:00
|
New issue 3411: mixin column on declared_attr not getting set up for __table_args__, 1.0 https://bitbucket.org/zzzeek/sqlalchemy/issue/3411/mixin-column-on-declared_attr-not-getting Mike Bayer: ``` #!python from sqlalchemy.ext.declarative import declarative_base, declared_attr from sqlalchemy import Column, Integer, Unicode, UniqueConstraint Base = declarative_base() class Foo(object): foo = Column(Unicode(64), nullable=False) @declared_attr def bar(cls): return Column("bar", Integer) class ItemCategory(Base, Foo): __tablename__ = 'item_category' id = Column(Integer, primary_key=True) name = Column(Unicode(64), nullable=False) __table_args__ = ( UniqueConstraint(name, "foo", "bar", name='unique_category_and_parent'),) ``` |
|
From: Andrey S. <iss...@bi...> - 2015-05-01 10:39:59
|
New issue 3410: JSONB field doesn't track changes https://bitbucket.org/zzzeek/sqlalchemy/issue/3410/jsonb-field-doesnt-track-changes Andrey Semenov: I have a code like this: ``` #!python stats = Column(JSONB, nullable=False, default={}) ``` then having model object with: ``` #!ipython In [17]: o.stats Out[17]: {} In [18]: id(o.stats) Out[18]: 4377529152 ``` I then modify `stats` column ``` #!ipython In [20]: o.account_log(log) In [21]: o.stats Out[21]: {'traffic': {'attempt_ts_spawn': 1430474948, 'confirm_operator_id': 185, 'confirm_ts_spawn': 1430474948}} In [22]: id(o.stats) Out[22]: 4375370840 ``` at the end of `account_log` the stats is re-assigned with `copy.deepcopy`, but when doing `Session.flush()` I see no requests done to the server. As I understand sqlalchemy doesn't think there's any change to model made to flush it to server. How could I ensure the changes are flushed to the SQL server? |
|
From: Pavel B. <iss...@bi...> - 2015-05-01 08:37:32
|
New issue 3409: 0.9.x - 1.0.x regression - AttributeError: entity when using label() with attribute of aliased entity https://bitbucket.org/zzzeek/sqlalchemy/issue/3409/09x-10x-regression-attributeerror-entity Pavel Brych: After upgrading to 1.0.2 resp. 1.0.3 SQLAlchemy, this error popped up. It happens when label() is used with attribute of aliased entity. ``` #!python #!/usr/bin/python # -*- coding: utf-8 -*- from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import aliased Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String(255)) realname = Column(String(255)) e = create_engine("postgresql://user:passwd@localhost/db_name", echo=True) Base.metadata.create_all(e) session = Session(e) user = aliased(User,name="user") q = session.query(user.username.label("username")) print(q.column_descriptions) ``` ``` #!python Traceback (most recent call last): File "/home/pavel/python/hores/src/sqlalchemytest.py", line 27, in <module> print(q.column_descriptions) File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py", line 2583, in column_descriptions for ent in self._entities File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py", line 2583, in <listcomp> for ent in self._entities File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/util.py", line 398, in __getattr__ raise AttributeError(key) AttributeError: entity ``` |
|
From: Mike B. <iss...@bi...> - 2015-05-01 02:36:52
|
New issue 3408: intrumentation ext fixture can leak into test suite and seems to break some of the manager finder tests https://bitbucket.org/zzzeek/sqlalchemy/issue/3408/intrumentation-ext-fixture-can-leak-into Mike Bayer: this is probably in 0.9, nothing has changed here...might be just a bug in the ext instrumentation and would need a test there ``` #! =================================== FAILURES =================================== ___________________ MapperTest.test_unmapped_not_type_error ____________________ [gw2] linux2 -- Python 2.7.6 /var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/bin/python Traceback (most recent call last): File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/test/orm/test_mapper.py", line 1607, in test_unmapped_not_type_error class_mapper, 5 File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/testing/assertions.py", line 248, in assert_raises_message callable_(*args, **kwargs) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 421, in class_mapper mapper = _inspect_mapped_class(class_, configure=configure) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 392, in _inspect_mapped_class class_manager = manager_of_class(class_) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/ext/instrumentation.py", line 169, in manager_of_class return self._manager_finders.get(cls, _default_manager_getter)(cls) File "/opt/python2.7/lib/python2.7/weakref.py", line 284, in get return self.data.get(ref(key),default) TypeError: cannot create weak reference to 'int' object _______________ MapperTest.test_unmapped_not_type_error_iter_ok ________________ [gw2] linux2 -- Python 2.7.6 /var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/bin/python Traceback (most recent call last): File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/test/orm/test_mapper.py", line 1614, in test_unmapped_not_type_error_iter_ok class_mapper, (5, 6) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/testing/assertions.py", line 248, in assert_raises_message callable_(*args, **kwargs) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 421, in class_mapper mapper = _inspect_mapped_class(class_, configure=configure) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 392, in _inspect_mapped_class class_manager = manager_of_class(class_) File "/var/jenkins/workspace/sqlalchemy-default-mysql-multi-2.7/.tox/full/lib/python2.7/site-packages/sqlalchemy/ext/instrumentation.py", line 169, in manager_of_class return self._manager_finders.get(cls, _default_manager_getter)(cls) File "/opt/python2.7/lib/python2.7/weakref.py", line 284, in get return self.data.get(ref(key),default) TypeError: cannot create weak reference to 'tuple' object =========================== short test summary info ============================ ``` |