You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have to construct views with static parameters if we want to reuse them across many filters e.g.
CREATE VIEW sold_by_duration AS
SELECT
duration,
count() AS value
FROM default.uk_price_paid
WHERE ((postcode1 = {_postcode:String}) OR (district = {_district:String}) OR (town = {_town:String}))
GROUP BY duration
SELECT *
FROM sold_by_duration(_postcode = 'SL4', _district = 'X', _town = 'X')
Proposal is to allow a column name to be passed e.g.
CREATE VIEW sold_by_duration AS
SELECT
duration,
count() AS value
FROM default.uk_price_paid
WHERE _column:Column = {_value:String}
GROUP BY duration
SELECT *
FROM sold_by_duration(_column = 'postcode1', _value = 'SL4')
Alternative and maybe complementary is to allow parameters to be optional - they will in turn be optimized away. This is more challenging obviously i.e.
SELECT *
FROM sold_by_duration(_postcode = 'SL4')
becomes
SELECT
duration,
count() AS value
FROM default.uk_price_paid
WHERE postcode1 = 'SL4'
GROUP BY duration
The text was updated successfully, but these errors were encountered:
gingerwizard
changed the title
Allow parametized views to be dynamic with optional parameteras
Allow parametized views to be dynamic with optional parameters
May 15, 2023
If the query parameter represents the name of a database, table, function or other identifier, use Identifier for its type. For example, the following query returns rows from a table named uk_price_paid:
SET param_mytablename ="uk_price_paid";
SELECT*FROM {mytablename:Identifier};
Currently we have to construct views with static parameters if we want to reuse them across many filters e.g.
Proposal is to allow a column name to be passed e.g.
Alternative and maybe complementary is to allow parameters to be optional - they will in turn be optimized away. This is more challenging obviously i.e.
The text was updated successfully, but these errors were encountered: