Closed poppyc0ck closed 4 years ago
Resolution was provided and it worked. As per the issue reported, there was an additional new line encountered in the connection string provided in the database section. Removal of the additional new line made things work as expected. Traces were collected for the same and after analysing the same the resolution was provided.
Thanks.
@amukherjee28 , I'm also facing the same error. Can you please provide what is the resolution for this error? Thanks.
Hi There,
Use the Flask-admin and connect to DB2 with Flask Sqlalchemy(ORM)
and description on https://flask-admin.readthedocs.io/en/latest/api/mod_contrib_sqla/
Usage admin = Admin() admin.add_view(ModelView(User, db.session))
Errors shown below
sqlalchemy.exc.ProgrammingError: (ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: Exception('SQLNumResultCols failed: [IBM][CLI Driver][DB2/AIX64] SQL0245N The invocation of routine "COUNT" is ambiguous. The argument in position "1" does not have a best fit. SQLSTATE=428F5\r SQLCODE=-245') [SQL: SELECT count(?) AS count_1 FROM "user"] [parameters: (b'*',)] (Background on this error at: http://sqlalche.me/e/f405)
Traceback (most recent call last): File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 2463, in call return self.wsgi_app(environ, start_response) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_compat.py", line 39, in reraise raise value File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_compat.py", line 39, in reraise raise value File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask\app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_admin\base.py", line 69, in inner return self._run_view(f, *args, *kwargs) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_admin\base.py", line 368, in _run_view return fn(self, args, *kwargs) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_admin\model\base.py", line 1970, in index_view view_args.search, view_args.filters, page_size=page_size) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\flask_admin\contrib\sqla\view.py", line 1065, in get_list count = count_query.scalar() if count_query else None File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\orm\query.py", line 3330, in scalar ret = self.one() File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\orm\query.py", line 3300, in one ret = self.one_or_none() File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\orm\query.py", line 3269, in one_or_none ret = list(self) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\orm\query.py", line 3342, in iter return self._execute_and_instances(context) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\orm\query.py", line 3367, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute return meth(self, multiparams, params) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\engine\base.py", line 1107, in _execute_clauseelement distilled_params, File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\engine\base.py", line 1253, in _execute_context e, statement, parameters, cursor, context File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\engine\base.py", line 1473, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\util\compat.py", line 398, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\util\compat.py", line 152, in reraise raise value.with_traceback(tb) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\sqlalchemy\engine\base.py", line 1249, in _execute_context cursor, statement, parameters, context File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\ibm_db_sa\ibm_db.py", line 112, in do_execute cursor.execute(statement, parameters) File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\ibm_db_dbi.py", line 1356, in execute self._set_cursor_helper() File "C:\Users\ct\Anaconda3\envs\rpt_siqx\lib\site-packages\ibm_db_dbi.py", line 1239, in _set_cursor_helper raise self.messages[len(self.messages) - 1] sqlalchemy.exc.ProgrammingError: (ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: Exception('SQLNumResultCols failed: [IBM][CLI Driver][DB2/AIX64] SQL0245N The invocation of routine "COUNT" is ambiguous. The argument in position "1" does not have a best fit. SQLSTATE=428F5\r SQLCODE=-245') [SQL: SELECT count(?) AS count_1 FROM "user"] [parameters: (b'',)] (Background on this error at: http://sqlalche.me/e/f405)
Many thanks.