feature request / tracking issue: parameterized views
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
Direzione di ricerca
This is a design proposal, not a ready task: the author asks for feedback before implementing. Start with the ViewKind class, which the payload says already has a parameterized attribute, and the place where views are rendered for DuckDB and ClickHouse. Done would mean agreed design decisions on parameter typing, defaults and name resolution, followed by an accepted implementation plan. Wait for maintainer direction before writing code.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey guys,
A few issues/PRs have been raised around parameterized views / duckdb macros / table-value-functions:
#5786 #4002 .
I am going to have a shot at implementing this, just touching base first.
Proposal:
Models of kind VIEW can take a parameters argument:
model (
name = my_parameterized_view,
kind = VIEW (
parameters ( discount_rate Float64 )
)
)
select
sum(total * (1 / (1 + discount_rate)**t )) as discounted_total
from cashflows
group by all;
ViewKind in sqlmesh has a parameterized attribute that tracks this. (Materialized views work and represented internally in exactly the same way).
This then renders as an engine-specific parameterized view / etc, e.g. duckdb
create macro my_parameterized_view(discount_rate Float64)
as
select
sum(total * (1 / (1 + discount_rate)**t )) as discounted_total
from cashflows
group by all;
or clickhouse
create view my_parameterized_view
as
select
sum(total * (1 / (1 + {discount_rate:Float64})**t )) as discounted_total
from cashflows
group by all;
I intend to implement both Clickhouse and DuckDB - these are quite different so I'm hopeful this will prevent any engine-specific assumptions from creeping in to the general stuff.
Known gnarliness:
- parameter typing (required, optional, not represented at all) differs widely between different DBs
- default value support differs widely between different DBs
- parameter name resolution / reference style differs widely between different DBs (e.g. see above, DuckDB refers to it as an identifier, Clickhouse refers to it as a parameter placeholder)
- initial spiking shows there will be some small sqlglot work required at least
Unknown but suspected gnarliness
- I'm not sure if sqlglot has the ability to translate between the different representations of this feature at the engine level, and personally I think it would be folly to try - this might imply some more engine-specific logic in sqlmesh as a result.
- I suspect there are engines around that don't even put these things in a database/schema scope - i don't intend to try and fix this problem, but if such things exist they will probably block this from working in those engines
any feedback on the above before I start?
- Lingua principale
- Python
- Stelle
- 3.3k
- Fork
- 471
- Merge medio
- 6g 7h
- PR unite (30g)
- 35
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SQLMesh/sqlmesh
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
SQLMesh/sqlmesh#6008 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
VSCode Extension: SQLMesh LSP crashes on startup: ImportError: cannot import name 'WorkspaceDiagnosticRefreshRequest' with lsprotocol 2025.xForse già presa @boomesh11 l’ha presa 15 giorni fa. ApertaBug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 4 giorni
-
Improvement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
SQLMesh/sqlmesh#5696 · 6 commenti ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di SQLMesh/sqlmesh
Issue simili
-
[BUG][Low–Medium] founder_numbers.py silently reads a SAFE discount or pool target given as a fraction (0.2) as 0.2%Forse già presa @sumitkhond111-del l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bmad-code-org/BMAD-METHOD#3358 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
open-mmlab/mmcv#3352 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
OpenGithubs/weekly#263 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
comp/cli P3 type/feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NousResearch/hermes-agent#162784 ·
I maintainer di solito rispondono entro 1 giorno