For

>Could you expound on that a bit more? If the tables don't exist then it 
>becomes a moot point.

The question I'm hoping to answer is "what tables do I need to make in order to 
fulfil this query?".

For

>select * from foo;

I was wondering if I could get a call for 'foo' on the authorizer API, even 
though this query may not be able to be compiled to completion.

Regarding the other complexities you mentioned, point taken.  At the end of the 
day, though, the query results be based on zero or more actual tables- I was 
hoping there might be some robust way to detect what those are.

-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of David Raymond
Sent: Tuesday, February 12, 2019 2:12 PM
To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] Retrieve tables accessed by query

Could you expound on that a bit more? If the tables don't exist then it becomes 
a moot point.

If you have the extremely simple

select * from foo;

Then with no context "foo" is what's accessed.

But inside an actual database, "foo" could be a view involving other tables or 
views. And the query planner might use covering indexes that don't touch base 
tables at all, etc etc. And if it's a modifying statement there might be 
triggers that access their own things, etc. So are you looking for "parse this 
SQL", or "what specific bits of this specific database would get accessed were 
I to run this SQL"?

As a side point, if I recall, "the parsed AST" is something you can't get, 
specifically so that they're free to completely change it in any way they want 
at any time without the issue of "oops, this might break someone else's code." 
(Or I may be thinking of something else here)


-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Nelson, Erik - 2
Sent: Tuesday, February 12, 2019 1:00 PM
To: SQLite mailing list
Subject: Re: [sqlite] Retrieve tables accessed by query

Clemens Ladisch Sent: Tuesday, February 12, 2019 12:38 PM
>Zach Wasserman wrote:
>> Is anyone aware of an API I can use to determine which tables are accessed
>> by a given query?

Both Clemens and Warren had good comments.  I'm curious if there's a way to do 
it in a database where the tables *don't exist*.  For example, I have a query 
and I want to find out which tables the query makes so I can create only those. 
 This query is obviously not valid in the current database... will it still 
(for example) call the authorizer interface?

Thanks

Erik

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__mailinglists.sqlite.org_cgi-2Dbin_mailman_listinfo_sqlite-2Dusers&d=DwIGaQ&c=SFszdw3oxIkTvaP4xmzq_apLU3uL-3SxdAPNkldf__Q&r=3mFDfHOq-dU1rrQz09cmOjm2rdOZoX-v3kqQ0JKJclY&m=z_60ozV957S1aN7o8jya-G09AGlze-BReDPKaQJHJqM&s=Laupns_-TUEj7GOdta_BY0AA-BpZ-yEuUfwRLHz-Z_I&e=
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__mailinglists.sqlite.org_cgi-2Dbin_mailman_listinfo_sqlite-2Dusers&d=DwIGaQ&c=SFszdw3oxIkTvaP4xmzq_apLU3uL-3SxdAPNkldf__Q&r=3mFDfHOq-dU1rrQz09cmOjm2rdOZoX-v3kqQ0JKJclY&m=z_60ozV957S1aN7o8jya-G09AGlze-BReDPKaQJHJqM&s=Laupns_-TUEj7GOdta_BY0AA-BpZ-yEuUfwRLHz-Z_I&e=

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to