Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add two new articles #286

Merged
merged 5 commits into from
Nov 22, 2019
Merged

Add two new articles #286

merged 5 commits into from
Nov 22, 2019

Conversation

cutterkom
Copy link
Contributor

  • one article is the "history" part
  • the other article is a draft for a general DBI introductory vignette

Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good. Can we do another round?


* MariaDB, using the R-package [RMariaDB](https://github.com/r-dbi/RMariaDB)
* Postgres, using and the R-package [RPostgres](https://github.com/r-dbi/RPostgres)
* SQLite, using and the R-package [RSQLite](https://github.com/r-dbi/RSQLite)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many more, see #274.

DBI offers a set of classes and methods that define what operations are possible and how they are performed:

* connect/disconnect to the DBMS
* create and execute statements in the DBMS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parametrized queries

```{r}
library(DBI)

con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need to change to connect to Postgres or another database? What about ODBC?

Basically, it is the result of the most generic SQL call `SELECT * FROM <name>`.

```{r}
dbReadTable(con, "mtcars")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I access tables in a schema? (Difficult to show with SQLite.)

vignettes/DBI-introduction.Rmd Outdated Show resolved Hide resolved
```{r}
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
while(!dbHasCompleted(res)){
chunk <- dbFetch(res, n = 5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this enough material for a specialized article?

dbClearResult(res)
dbDisconnect(con)
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Parametrized queries?
  • Transactions?

krlmlr added a commit that referenced this pull request Nov 22, 2019
@krlmlr krlmlr merged commit 19cb049 into r-dbi:master Nov 22, 2019
@krlmlr
Copy link
Member

krlmlr commented Nov 22, 2019

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants