File: tbl-sql.md

package info (click to toggle)
r-cran-dbplyr 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,644 kB
  • sloc: sh: 13; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 947 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# sql tbl can be printed

    Code
      mf2
    Output
      # Source:   SQL [3 x 2]
      # Database: sqlite ?.?.? [:memory:]
            x     y
        <int> <int>
      1     1     3
      2     2     2
      3     3     1

# useful error if missing I()

    Code
      tbl(src_memdb(), "foo.bar")
    Condition
      Error in `tbl_sql()`:
      ! Failed to find table `foo.bar`.
      i Did you mean `from = I("foo.bar")`?
      Caused by error in `db_query_fields.DBIConnection()`:
      ! Can't query fields.
      i Using SQL: SELECT * FROM `foo.bar` AS `q05` WHERE (0 = 1)
      Caused by error:
      ! no such table: foo.bar

# check_from is deprecated

    Code
      tbl(con, "x", check_from = FALSE)
    Condition
      Warning:
      The `check_from` argument of `tbl_sql()` is deprecated as of dbplyr 2.5.0.
    Output
      # Source:   table<`x`> [0 x 1]
      # Database: sqlite 3.45.0 [:memory:]
      # i 1 variable: y <lgl>