digglife / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

Flask-Admin framework with DB2 10.5.5, sqlalchemy 1.0.4 and ibm-db driver #175

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Using Flask-Admin with:
Model
from flask_dsrc import db
from sqlalchemy import Column, DateTime, String, text, func

class Db2DbaTeam(db.Model):
    __tablename__ = 'db2_dba_team'
    __table_args__ = {u'schema': 'DBATB'}

    sid = Column(String(8), primary_key=True)

    def __repr__(self):
         return '<Sid %r>' % self.sid

__init__.py

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin import Admin
from flask.ext.admin.contrib import sqla

app = Flask(__name__)
app.config.from_object('settings')
db = SQLAlchemy(app)
admin = Admin(name="MyDB2Test-Web") 
from dbadmin.models  import * 
admin.add_view(sqla.ModelView(Db2DbaTeam,db.session))
admin.init_app(app)

What is the expected output? 
Content of the table request.

What do you see instead?
ProgrammingError: (ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: 
SQLNumResultCols failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0245N  The 
invocation of routine "COUNT" is ambiguous. The argument in position "1" does 
not have a best fit.  SQLSTATE=428F5 SQLCODE=-245 [SQL: 'SELECT count(?) AS 
count_1 \nFROM "DBATB".db2_dba_team'] [parameters: ('*',)]

What version of the product are you using? On what operating system?
Name: ibm-db
Version: 2.0.5.1
Summary: Python DBI driver for DB2 (LUW, zOS, i5) and IDS
Home-page: http://pypi.python.org/pypi/ibm_db/

Ubuntu 14.04 OS

Please provide any additional information below.
The SQL statement and parameter passed seems fine for me  ... 

Original issue reported on code.google.com by jkzl...@gmail.com on 8 Jun 2015 at 7:05

GoogleCodeExporter commented 9 years ago
"SELECT count(?) AS count_1 \nFROM "DBATB".db2_dba_team" This type of SQL is 
not supported in DB2

Original comment by rahul.pr...@in.ibm.com on 8 Jun 2015 at 6:26