0
錯誤我創建了一個連接:- [R dplyr:功能db_list_table將返回使用PostgreSQL
con <- src_postgres(dbname = 'mydb',
host = 'localhost',
port = 5432,
user = 'postgres',
password = 'postgres')
然而,像db_list_tables(con)
功能不工作: 應用於類的對象「c('src_postgres', 'src_sql', 'src')
爲db_list_tables
沒有適用的方法「
但我可以使用SQL得到的表列表:
print(tbl(con, sql("SELECT table_schema,table_name
FROM information_schema.tables
ORDER BY table_schema,table_name")), n=400)
另外在第二種情況下如何獲得tbl
中的行數?它顯示?? X2
,並試圖建立print n=Inf
或選項(tibble.print_max = Inf
)不工作:
Source: query [?? x 2]
Database: postgres 9.4.12 [[email protected]:5432/mydb]
Error in postgresqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not Retrieve the result : ERROR: column "inf" does not exist
LINE 5: LIMIT Inf
^
devtools::session_info()
Session info -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.3.3 (2017-03-06)
system x86_64, linux-gnu
ui RStudio (1.0.136)
language (EN)
collate en_US.UTF-8
tz America/Los_Angeles
date 2017-06-01
Packages -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.3.3)
DBI * 0.6-1 2017-04-01 CRAN (R 3.3.3)
devtools 1.12.0 2016-06-24 CRAN (R 3.3.1)
digest 0.6.12 2017-01-27 CRAN (R 3.3.2)
dplyr * 0.5.0 2016-06-24 CRAN (R 3.3.1)
magrittr 1.5 2014-11-22 CRAN (R 3.1.1)
memoise 1.1.0 2017-04-21 CRAN (R 3.3.3)
R6 2.2.0 2016-10-05 CRAN (R 3.3.1)
Rcpp 0.12.11 2017-05-22 CRAN (R 3.3.3)
RPostgreSQL * 0.4-1 2016-05-08 CRAN (R 3.3.3)
rstudioapi 0.6 2016-06-27 CRAN (R 3.3.1)
tibble 1.3.3 2017-05-28 CRAN (R 3.3.3)
withr 1.0.2 2016-06-20 CRAN (R 3.3.1)
在src_tbl函數名的末尾有一個缺少的's',我不能編輯你的答案,因爲它只有一個字符:) – user1946989