generated from rpkgs/rpkg.template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
147 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
*/temp | ||
*/*/temp | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(dbRemoveTables_like) | ||
export(db_append) | ||
export(db_info) | ||
export(get_dbInfo) | ||
export(import_table_large) | ||
export(open_mariadb) | ||
export(open_mysql) | ||
export(tbl_copy) | ||
import(DBI) | ||
import(crayon) | ||
import(dplyr) | ||
import(magrittr) | ||
importFrom(methods,new) | ||
importFrom(purrr,`%||%`) | ||
importFrom(utils,str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.html | ||
*.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "database_config" | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{database_config} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>" | ||
) | ||
``` | ||
|
||
## 如何配置数据库 | ||
|
||
```{r setup} | ||
# library(tidydb2) | ||
usethis::edit_file("~/.db.yml") | ||
``` | ||
|
||
按照如下格式填写,可以填写多个配置。 | ||
在不指定`name`或`dbname`的情况下,默认读取第一个。 | ||
|
||
``` | ||
kong-nas: | ||
host: kong-nas | ||
user: CUG | ||
pwd: passwd | ||
port: 3306 | ||
dbname: | ||
- ChinaMet | ||
remote-nas: | ||
host: xxxhydro.top | ||
user: CUG | ||
pwd: pwd | ||
port: 2306 | ||
dbname: | ||
- ChinaMet | ||
default: kong-nas | ||
``` | ||
|
||
## 测试连接 | ||
|
||
> 这里有改进空间 | ||
```{r, eval=FALSE} | ||
# source('scripts/main_pkgs.R') | ||
config = yaml::read_yaml("~/.db.yml") | ||
dbinfo = get_dbInfo() # see which db to read | ||
con_mysql = open_mysql() | ||
con_mariadb = open_mariadb(1, dbinfo) | ||
``` | ||
|
||
|