-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add two new articles #286
Conversation
cutterkom
commented
Oct 16, 2019
- one article is the "history" part
- the other article is a draft for a general DBI introductory vignette
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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:") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.)
```{r} | ||
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4") | ||
while(!dbHasCompleted(res)){ | ||
chunk <- dbFetch(res, n = 5) |
There was a problem hiding this comment.
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) | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Parametrized queries?
- Transactions?
Thanks! |