[PyQt] [PYQT5]display sqlite data in Qtableview Python
maziar.parsijani at gmail.com
Tue Jul 24 16:24:31 BST 2018
Obviously I have a problem with creation of qsqltableview not to put just
my data base.
Here you can see that I can read my database :
> import sqlite3
> conn = sqlite3.connect(' sqlite path to file.db ')
> conn_cursor = conn.cursor()
> conn.text_factory = str
> res = conn.execute("SELECT text FROM table WHERE condition='?';")
> for text in res:
> print (text)
I need a help to put these data which is text in qsqltable view and the
example have just created a db with its own data that I don't understand
anything of it.
On Tue, Jul 24, 2018 at 4:10 PM, Florian Bruhin <me at the-compiler.org> wrote:
> On Tue, Jul 24, 2018 at 01:54:13PM +0430, Maziar Parsijani wrote:
> > PYQT5 examples for sqlite and QSqlTableModel are not for reading sqlite
> > database and show them in QSqlTableModel.
> > I want to read my database rows and columns and show them in
> > QSqlTableModel.Are there any good examples for such thing ?
> The examples just use an in-memory database
> ("db.setDatabaseName(':memory:')" in connection.py). If you instead pass
> a filename to a sqlite database, it'll read that database.
> https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
> GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
> I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt