Re: creating tables needed for a query on-demand

"Andy Chambers" <achambers.home-gM/[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
> I've tried using an authorizer to do this, but the authorizer never sees
> the requested table's name, and thus can't do anything about it (at
> least not that I can see).

How about putting the query inside a try .. except block?

try:
    cursor.execute("select * from foo")
except OperationalError:
    cursor.execute("create table foo (bar  text);")
    cursor.execute("select * from foo")

Regards,
Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.