Hi, Thank you for your response and sorry for my unclear message.
Knowing SQLAlchemy has great code coverate I kept digging in ours. It appears the problem origins from a known issue described in https://bitbucket.org/zzzeek/sqlalchemy/issues/3921 <https://bitbucket.org/zzzeek/sqlalchemy/issues/3921/problems-creating-records-when-table-has> and https://bitbucket.org/zzzeek/sqlalchemy/issues/3923. We've actually patched that issue locally until the fix is officially released in SQLAlchemy ~1.3. In the mean time DefaultExecutionContext._exec_default since version 1.2.0b3 has extra argument - column. That broke our patch. Thank you for your help. Kind regards, Michal 2018-05-31 1:00 GMT+02:00 Mike Bayer <[email protected]>: > because SQLAlchemy has something like 98% code coverge and tens of > thousands of tests, it is very unusual for you to have such a stack > trace so no I don't know what's going on, I rely upon test coverage to > prevent cases like these. if this method doesn't work under > postgresql then it's usually the case that the method never gets > called under normal use cases (like the thousands we're testing), so I > need to see if you are doing something unusual or unexpected. > > So can you please provide: > > 1. database in use / driver, I assume are postgresql / psycopg2? > > 2. example models/tables > > 3. example invocation (eg. the INSERT statement or the ORM thing you are > doing) > > 4. preferably with a full MCVE and posted as an issue to > https://bitbucket.org/zzzeek/sqlalchemy/issues/new, or you can add it > here, thanks! > > > > On Wed, May 30, 2018 at 4:38 PM, mdob <[email protected]> wrote: > > Hi, > > > > I've upgraded SQLAlchemy from 1.0.18 to latest 1.2.8 and I get errors > that > > _exec_default() received wrong number of parameters. I've pinpointed that > > problem appears since version 1.2.0b3. > > Looks like inside method get_insert_default > > https://github.com/zzzeek/sqlalchemy/blob/rel_1_2/lib/ > sqlalchemy/engine/default.py#L1283 > > the self._exec_default is not actually method of > > sqlalchemy.engine.default.DefaultExecutionContext. > > > > Any ideas what is going on? > > > > > > Traceback: > > > > > > 2018-05-30 21:24:38,977 ERROR [waitress] (exceptions.TypeError) > > _exec_default() takes exactly 3 arguments (4 given) [SQL: u'INSERT INTO > > timesheet (user_id, project_id, date) VALUES (?, ?, ?)'] [parameters: > > [{u'project_id': 1, u'user_id': 1}]] > > Traceback (most recent call last): > > File "/home/mike/projects/slashdb/slashdb/utils.py", line 430, in > > func_wrapper > > return func(*args, **kwargs) > > File "/home/mike/projects/slashdb/slashdb/data_discovery_views.py", > line > > 90, in post_view > > locations = data_proxy.create(create_data) > > File > > "/home/mike/projects/slashdb/slashdb/models/sqlalchemy_sdb/ > dataproxy.py", > > line 415, in create > > self._add_all(new_resources) > > File "/home/mike/projects/slashdb/slashdb/models/sqlalchemy_sdb/ > utils.py", > > line 32, in wrapper > > return dataproxy_method(dataproxy, *args, **kwargs) > > File > > "/home/mike/projects/slashdb/slashdb/models/sqlalchemy_sdb/ > dataproxy.py", > > line 399, in _add_all > > self.db_session.flush() > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/session.py", > > line 2254, in flush > > self._flush(objects) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/session.py", > > line 2380, in _flush > > transaction.rollback(_capture_exception=True) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/util/langhelpers.py", > > line 66, in __exit__ > > compat.reraise(exc_type, exc_value, exc_tb) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/session.py", > > line 2344, in _flush > > flush_context.execute() > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/unitofwork.py", > > line 391, in execute > > rec.execute(self) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/unitofwork.py", > > line 556, in execute > > uow > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/persistence.py", > > line 181, in save_obj > > mapper, table, insert) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/orm/persistence.py", > > line 866, in _emit_insert_statements > > execute(statement, params) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/base.py", > > line 948, in execute > > return meth(self, multiparams, params) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/sql/elements.py", > > line 269, in _execute_on_connection > > return connection._execute_clauseelement(self, multiparams, params) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/base.py", > > line 1060, in _execute_clauseelement > > compiled_sql, distilled_params > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/base.py", > > line 1132, in _execute_context > > None, None) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/base.py", > > line 1413, in _handle_dbapi_exception > > exc_info > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/util/compat.py", > > line 203, in raise_from_cause > > reraise(type(exception), exception, tb=exc_tb, cause=cause) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/base.py", > > line 1127, in _execute_context > > context = constructor(dialect, self, conn, *args) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/default.py", > > line 650, in _init_compiled > > self._process_executesingle_defaults() > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/default.py", > > line 1342, in _process_executesingle_defaults > > val = self.get_insert_default(c) > > File > > "/home/mike/envs/slashdb/lib/python2.7/site-packages/ > sqlalchemy/engine/default.py", > > line 1287, in get_insert_default > > return self._exec_default(column, column.default, column.type) > > StatementError: (exceptions.TypeError) _exec_default() takes exactly 3 > > arguments (4 given) [SQL: u'INSERT INTO timesheet (user_id, project_id, > > date) VALUES (?, ?, ?)'] [parameters: [{u'project_id': 1, u'user_id': > 1}]] > > > > > > Python 2.7.13 > > > > pip freeze > > > > > > atomicwrites==1.1.5 > > attrs==18.1.0 > > backports.functools-lru-cache==1.5 > > beautifulsoup4==4.6.0 > > funcsigs==1.0.2 > > hupper==1.3 > > ibm-db==2.0.8 > > ibm-db-sa==0.3.3 > > lxml==4.2.1 > > Mako==1.0.7 > > MarkupSafe==1.0 > > mock==2.0.0 > > more-itertools==4.2.0 > > MySQL-python==1.2.5 > > nose==1.3.7 > > passlib==1.7.1 > > Paste==2.0.3 > > PasteDeploy==1.5.2 > > PasteScript==2.0.2 > > pbr==4.0.3 > > plaster==1.0 > > plaster-pastedeploy==0.5 > > pluggy==0.6.0 > > portalocker==1.2.1 > > psycopg2==2.7.4 > > py==1.5.3 > > pyodbc==4.0.23 > > pyramid==1.9.2 > > pyramid-exclog==1.0 > > pyramid-mako==1.0.2 > > pyramid-multiauth==0.9.0 > > pytest==3.6.0 > > python-dateutil==2.7.3 > > python-memcached==1.59 > > PyYAML==3.12 > > repoze.lru==0.7 > > simplejson==3.15.0 > > six==1.11.0 > > SQLAlchemy==1.2.0b3 > > testfixtures==6.0.2 > > translationstring==1.3 > > uWSGI==2.0.17 > > venusian==1.1.0 > > waitress==1.1.0 > > WebOb==1.8.1 > > WebTest==2.0.18 > > wsgicors==0.7.0 > > yolk==0.4.3 > > zope.deprecation==4.3.0 > > zope.interface==4.5.0 > > > > > > > > > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and > > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > > description. > > --- > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
