daranzolin / sqltargets

targets extension for SQL queries
https://daranzolin.github.io/sqltargets/
Other
36 stars 2 forks source link

tar_prql shorthand? #2

Open daranzolin opened 5 months ago

daranzolin commented 5 months ago

Rather than a separate function, this could maybe better work as a separate argument to tar_sql e.g. is_prql = TRUE. Then call prqlr::prql_compile() within source_sql_to_dataframe.

daranzolin commented 5 months ago

There are several options for implementation.

Option 1: PRQL in .sql files (or .prql files)

Pros: Minimal changes needed to API and code. Cons: Can't modify and preview query results in RStudio (but could in Visual Studio), no syntax highlighting

Option 2: PRQL in .qmd files

Pros: Can modify and view query results in RStudio. Cons: Significant changes to underlying code, plus quarto dependency, plus some visual awkwardness:

...
tar_prql(query, "queries/prql_query.qmd")
...

Option 3: Wait until RStudio supports .prql files

Enhancement suggested in https://github.com/rstudio/rstudio/issues/14547 Pros: Minimal changes needed. Cons: Might never happen