Re: creating tables needed for a query on-demand
Roger Binns <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ryan Blazecka wrote: > > Roger Binns wrote: >> The authorizer only works on valid statements. You have various gnarly >> issues such as telling the difference between a typo and what someone >> really meant. >> >> > that's fine, and in fact exactly what I want. if the statement isn't > valid SQL, my authorizer shouldn't see it anyways. if it can't > ultimately be executed, there's no point in me populating the tables. What I meant is that the schema has to be correct - ie tables and columns have to exist. > nope. the majority of my users should not be concerned about how the > backend is working. they want to click a button and see the results. > making the users manually populate the tables is too complicated for > something the computer can (and should) be able to take care of on it's own. Then why are you using SQL at all? Why not just present your data? > what I'm actually doing is executing the query possibly twice. the first > time through, I execute the query, and the authorizer logs which tables > were referenced. after the query finishes I then check this list, and > see if any of those tables should be [re-]populated. if so, I populate > them, and run the query again to get the final results. it seems like a > bit of a waste to run the query twice, but for the queries I've tried, > SQLite is pretty quick. besides, the cases where it IS executed twice > are the cases when I'm repopulating the tables anyways, and that time > dwarfs the execution time for the SELECT. Ok, it really sounds like you should be using virtual tables at which point none of this is an issue! Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFx5+xmOOfHg372QQRAqbyAJ9dAskD33vPVln3DolivSswmFKHWACggDWP RHsVnRwDJE/ILzz5ckO2fKs= =fSgc -----END PGP SIGNATURE-----