Skip to content

Commit

Permalink
docs: Use relational.fel.cvut.cz
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Aug 13, 2024
1 parent d9cd3ee commit 002e5be
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 39 deletions.
8 changes: 4 additions & 4 deletions R/financial-db-con.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' Connection to SQL Financial Database
#' @description Connects to relational.fit.cvut.cz unless the service is
#' @description Connects to relational.fel.cvut.cz unless the service is
#' unavailable, in which case databases.pacha.dev is used as a fallback
#' @return A `MariaDBConnection` object
#' @noRd
Expand All @@ -12,7 +12,7 @@ financial_db_con <- function() {
err_dbedu <- tryCatch(return(dbedu_con()), error = identity)

abort(paste0(
"Can't connect to relational.fit.cvut.cz or databases.pacha.dev:\n",
"Can't connect to relational.fel.cvut.cz or databases.pacha.dev:\n",
conditionMessage(err_relational), "\n",
conditionMessage(err_dbedu)
))
Expand All @@ -22,9 +22,9 @@ relational_con <- function() {
DBI::dbConnect(
RMariaDB::MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/financial.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @description
#' `dm_financial()` creates an example [`dm`] object from the tables at
#' https://relational.fit.cvut.cz/dataset/Financial.
#' https://relational.fel.cvut.cz/dataset/Financial.
#' The connection is established once per session,
#' subsequent calls return the same connection.
#'
Expand Down
4 changes: 2 additions & 2 deletions demo/milano.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ library(DBI) # <<
mydb <- dbConnect(
RMariaDB::MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)


Expand Down
4 changes: 2 additions & 2 deletions demo/neuchatel.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ library(DBI) # <<
mydb <- dbConnect(
RMariaDB::MariaDB(),
user = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)


Expand Down
2 changes: 1 addition & 1 deletion man/dm_financial.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-learn.R
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ test_that("dm_from_con() with mariaDB", {
my_db <- RMariaDB::dbConnect(
RMariaDB::MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
expect_snapshot_output(my_dm <- dm_from_con(my_db))
expect_snapshot(dm::dm_get_all_fks(my_dm))
Expand Down
4 changes: 2 additions & 2 deletions vignettes/dm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ library(RMariaDB)
fin_db <- dbConnect(
MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
``````

Expand Down
14 changes: 7 additions & 7 deletions vignettes/howto-dm-db.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ To this end, a dm object can be created from any database that has a {[DBI](http
When a dm object is created via a DBI connection to an RDBMS, it can import all the tables in the database, the active schema, or a limited set.
For some RDBMS, such as Postgres, SQL Server and MariaDB, primary and foreign keys are also imported and do not have to be manually added afterwards.

To demonstrate, we will connect to a `r href("relational dataset repository", "https://relational.fit.cvut.cz/")` with a database server that is publicly accessible without registration.
It hosts a `r href("financial dataset", "https://relational.fit.cvut.cz/dataset/Financial")` that contains loan data along with relevant account information and transactions.
To demonstrate, we will connect to a `r href("relational dataset repository", "https://relational.fel.cvut.cz/")` with a database server that is publicly accessible without registration.
It hosts a `r href("financial dataset", "https://relational.fel.cvut.cz/dataset/Financial")` that contains loan data along with relevant account information and transactions.
We chose this dataset because the relationships between `loan`, `account`, and `transactions` tables are a good representation of databases that record real-world business transactions.

Below, we open a connection to the publicly accessible database server using their documented connection parameters.
Expand All @@ -38,9 +38,9 @@ library(RMariaDB)
my_db <- dbConnect(
MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
``````

Expand Down Expand Up @@ -102,7 +102,7 @@ fin_dm <- dm_from_con(my_db, learn_keys = FALSE)
fin_dm
``````

The `r href("model diagram", "https://relational.fit.cvut.cz/assets/img/datasets-generated/financial.svg")` provided by our test database loosely illustrates the intended relationships between tables.
The `r href("model diagram", "https://relational.fel.cvut.cz/assets/img/datasets-generated/financial.svg")` provided by our test database loosely illustrates the intended relationships between tables.
In the diagram, we can see that the `loans` table should be linked to the `accounts` table.
Below, we create those links in 3 steps:

Expand Down Expand Up @@ -155,9 +155,9 @@ my_db_fun <- function() {
dbConnect(
MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
}
Expand Down
12 changes: 6 additions & 6 deletions vignettes/out/dm.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fin_db <- dbConnect(
username = 'guest',
password = 'relational',
dbname = 'Financial_ijs',
host = 'relational.fit.cvut.cz'
host = 'relational.fel.cvut.cz'
)
```

Expand All @@ -40,7 +40,7 @@ library(dm)
fin_dm <- dm_from_con(fin_db)
fin_dm
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `accounts`, `cards`, `clients`, `disps`, `districts`, … (9 total)
#> Columns: 57
Expand All @@ -62,7 +62,7 @@ names(fin_dm)
#> [7] "orders" "tkeys" "trans"
fin_dm$loans
#> # Source: table<`Financial_ijs`.`loans`> [?? x 7]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> id account_id date amount duration payments status
#> <int> <int> <date> <dbl> <int> <dbl> <chr>
#> 1 4959 2 1994-01-05 80952 24 3373 A
Expand All @@ -78,7 +78,7 @@ fin_dm$loans
#> # … with more rows
dplyr::count(fin_dm$trans)
#> # Source: lazy query [?? x 1]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> n
#> <int64>
#> 1 1056320
Expand Down Expand Up @@ -148,7 +148,7 @@ fin_dm_keys %>%
#> Renamed columns:
#> * date -> loans.date, accounts.date
#> # Source: lazy query [?? x 25]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> id account_id loans.date amount duration payments status district_id
#> <int> <int> <date> <dbl> <int> <dbl> <chr> <int>
#> 1 4959 2 1994-01-05 80952 24 3373 A 1
Expand Down Expand Up @@ -216,7 +216,7 @@ fin_dm_total <-

fin_dm_total$total_loans
#> # Source: lazy query [?? x 2]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> account_id total_amount
#> <int> <dbl>
#> 1 2 80952
Expand Down
24 changes: 12 additions & 12 deletions vignettes/out/howto-dm-db.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ foreign keys are also imported and do not have to be manually added
afterwards.

To demonstrate, we will connect to a [relational dataset
repository](https://relational.fit.cvut.cz/) with a database server that
repository](https://relational.fel.cvut.cz/) with a database server that
is publicly accessible without registration. It hosts a [financial
dataset](https://relational.fit.cvut.cz/dataset/Financial) that contains
dataset](https://relational.fel.cvut.cz/dataset/Financial) that contains
loan data along with relevant account information and transactions. We
chose this dataset because the relationships between `loan`, `account`,
and `transactions` tables are a good representation of databases that
Expand All @@ -32,9 +32,9 @@ library(RMariaDB)
my_db <- dbConnect(
MariaDB(),
username = "guest",
password = "relational",
password = "ctu-relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
host = "relational.fel.cvut.cz"
)
```

Expand All @@ -47,7 +47,7 @@ library(dm)
my_dm <- dm_from_con(my_db)
my_dm
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `accounts`, `cards`, `clients`, `disps`, `districts`, … (9 total)
#> Columns: 57
Expand Down Expand Up @@ -90,7 +90,7 @@ accounts <- tbl(my_db, "accounts")
my_manual_dm <- dm(loans, accounts)
my_manual_dm
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `loans`, `accounts`
#> Columns: 11
Expand All @@ -110,7 +110,7 @@ information on keys and a crash course on databases, see
`vignette("howto-dm-theory")`.

The [model
diagram](https://relational.fit.cvut.cz/assets/img/datasets-generated/financial.svg)
diagram](https://relational.fel.cvut.cz/assets/img/datasets-generated/financial.svg)
provided by our test database loosely illustrates the intended
relationships between tables. In the diagram we can see that the `loans`
table should be linked to the `accounts` table. Below we create those
Expand Down Expand Up @@ -153,7 +153,7 @@ trans <- tbl(my_db, "trans")
my_dm_keys %>%
dm(trans)
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `loans`, `accounts`, `trans`
#> Columns: 21
Expand All @@ -173,7 +173,7 @@ it are transient unless stored in a new variable.
``` r
my_dm_keys
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `loans`, `accounts`
#> Columns: 11
Expand All @@ -186,7 +186,7 @@ my_dm_trans <-

my_dm_trans
#> ── Table source ───────────────────────────────────────────────────────────
#> src: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> src: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> ── Metadata ───────────────────────────────────────────────────────────────
#> Tables: `loans`, `accounts`, `trans`
#> Columns: 21
Expand All @@ -203,7 +203,7 @@ my_dm_keys %>%
#> Renamed columns:
#> * date -> loans.date, accounts.date
#> # Source: lazy query [?? x 10]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> id account_id loans.date amount duration payments status district_id
#> <int> <int> <date> <dbl> <int> <dbl> <chr> <int>
#> 1 4959 2 1994-01-05 80952 24 3373 A 1
Expand Down Expand Up @@ -285,7 +285,7 @@ in the dm object.
``` r
my_dm_total$total_loans
#> # Source: lazy query [?? x 2]
#> # Database: mysql [guest@relational.fit.cvut.cz:NA/Financial_ijs]
#> # Database: mysql [guest@relational.fel.cvut.cz:NA/Financial_ijs]
#> account_id total_amount
#> <int> <dbl>
#> 1 2 80952
Expand Down

0 comments on commit 002e5be

Please sign in to comment.