tests/testthat/_snaps/knitr-engine.md

Snapshot test of knitr-engine

Code
  .knit_file("r-style-opts.Rmd")
Output



  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```

  ```sql
  SELECT
    cyl,
    mpg,
    ROUND(mpg, 0) AS mpg_int
  FROM
    mtcars
  WHERE
    cyl > 6
  ORDER BY
    (
      SELECT
        NULL
    ) OFFSET 0 ROWS
  FETCH FIRST
    3 ROWS ONLY
  ```


  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```




  Table: 3 records

  | cyl|  mpg| mpg_int|
  |---:|----:|-------:|
  |   8| 18.7|      19|
  |   8| 14.3|      14|
  |   8| 16.4|      16|
Code
  .knit_file("yaml-style-opts.Rmd")
Output



  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```

  ```sql
  SELECT
    cyl,
    mpg,
    ROUND(mpg, 0) AS mpg_int
  FROM
    mtcars
  WHERE
    cyl > 6
  ORDER BY
    (
      SELECT
        NULL
    ) OFFSET 0 ROWS
  FETCH FIRST
    3 ROWS ONLY
  ```


  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```




  Table: 3 records

  | cyl|  mpg| mpg_int|
  |---:|----:|-------:|
  |   8| 18.7|      19|
  |   8| 14.3|      14|
  |   8| 16.4|      16|
Code
  withr::with_options(list(prqlr.target = "sql.mssql", prqlr.format = FALSE,
    prqlr.signature_comment = FALSE), .knit_file("minimal.Rmd"))
Output

  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```

  ```sql
  SELECT
    cyl,
    mpg,
    ROUND(mpg, 0) AS mpg_int
  FROM
    mtcars
  WHERE
    cyl > 6
  ORDER BY
    (
      SELECT
        NULL
    ) OFFSET 0 ROWS
  FETCH FIRST
    3 ROWS ONLY
  ```
Code
  .knit_file("glue.Rmd")
Output

  ``` r
  a <- "hello"
  b <- "world"
  ```


  ``` elm
  from hello
  select world
  ```

  ```sql
  SELECT
    world
  FROM
    hello
  ```




  ``` elm
  from mtcars
  select hello
  ```

  ```
  ## Error: no such column: hello
  ```
Code
  .knit_file("change-lang.Rmd")
Output

  ``` prql
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```

  ```sql
  SELECT
    cyl,
    mpg,
    ROUND(mpg, 0) AS mpg_int
  FROM
    mtcars
  WHERE
    cyl > 6
  LIMIT
    3

  -- Generated by PRQL compiler version:0.13.4 (https://prql-lang.org)
  ```




  ``` foo
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```




  Table: 3 records

  | cyl|  mpg| mpg_int|
  |---:|----:|-------:|
  |   8| 18.7|      19|
  |   8| 14.3|      14|
  |   8| 16.4|      16|
Code
  .knit_file("info-string.Rmd")
Output

  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```

  ```{.sql filename="SQL"}
  SELECT
    cyl,
    mpg,
    ROUND(mpg, 0) AS mpg_int
  FROM
    mtcars
  WHERE
    cyl > 6
  LIMIT
    3

  -- Generated by PRQL compiler version:0.13.4 (https://prql-lang.org)
  ```
Code
  .knit_file("eval-opt.Rmd")
Output



  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```


  ``` elm
  from mtcars
  filter cyl > 6
  select {cyl, mpg}
  derive {mpg_int = math.round 0 mpg}
  take 3
  ```


  ``` elm
  from {{foo}}
  ```


Try the prqlr package in your browser

Any scripts or data that you put into this service are public.

prqlr documentation built on April 12, 2025, 1:47 a.m.