-
Recently discovered sqlpage and it took about a day to build a dashboard out of my bank statement. SQLPage is a lovely project for the ease to convert ideas to UI. Now facing a small challenge - my queries are all in one file executed as I can drop the temporary table if it exists and proceed since I'm the only one using now. However, when I try to use a $ variable as table name, sqlpage is unable to parse the statement. SET filtered = 'filtered_'||sqlpage.random_string(12);
select $filtered; -- this is fine; example output is filtered_duR6Go7BD6fJ
drop table if exists $filtered; -- all these fail to parse at $
create temporary table $filtered ...
select * from $filtered ... PS: I don't like the idea of dynamic FROM clause. This is simply to reduce the code size (m4 macros is a good alternative:). An added advantage with temporary table is that I get a cache for some 6 queries further along. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello, and welcome to SQLPage! Using a fixed static name for a temporary table should just work, no matter how many requests you process concurrently. |
Beta Was this translation helpful? Give feedback.
-
In case someone else stumbles on this discussion later, and needs dynamic from clauses for other reasons. If you’re looking to use a dynamic table name in If you have two tables,
|
Beta Was this translation helpful? Give feedback.
Hello, and welcome to SQLPage!
I think there may be a misunderstanding about how temporary tables or connection handling in SQLPage works... I wrote a short post on the subject recently: #871 (comment)
Using a fixed static name for a temporary table should just work, no matter how many requests you process concurrently.