[PyQt] remove quotes from QSqlTableModel.selectstatement

Ivan Coronado icoronado at epcge.com
Tue Jul 21 14:18:05 BST 2009


Hello
I'm using PyQt  ODBC support to access a database. If I use QSqlQuery
works fine, but when I use QSqlTableModel the table is filled by the
names of collums. An example here:
 
exp_1    exp_2    exp_3    exp_4
name    date        time       cheked
name    date        time       cheked
name    date        time       cheked
name    date        time       cheked
 
I have tracked the odbc call and I discovered that the query that
TableModel does is this:
select "name", "date", "time","cheked" from "prcli"
This is the selectstatemente of my QSqlTableModel. I think that the
quotes are wrong. How can I change the query to get something like
this?:
select name, date, time,cheked from prcli
 
self.model=QtSql.QSqlTableModel(self,cn)

self.model.setTable(tableName)

self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)

print self.model.selectStatement() # here I get this ->select "name",
"date", "time","cheked" from "prcli"

self.model.select()

Ivan Coronado
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090721/62cc884a/attachment.html


More information about the PyQt mailing list