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

Snapshot updates for rcc-full ({"config":{"os":"ubuntu-22.04","r":"release","test-src":"test-mysql","covr":true,"desc":"MySQL with covr"}}) #2102

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ jobs:
- {os: ubuntu-20.04, r: 'release', test-src: 'test-mssql', covr: false, desc: 'SQL Server without covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-postgres', covr: true, desc: 'Postgres with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-maria', covr: true, desc: 'MariaDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-mysql-maria', covr: true, desc: 'MySQL with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-mysql', covr: true, desc: 'MySQL with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-duckdb', covr: true, desc: 'DuckDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-sqlite', covr: true, desc: 'SQLite with covr' }
# End custom: matrix elements
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -3,19 +3,19 @@ all: qtest
# Quiet tests
# Run with make -j $(nproc) -O
# or with pmake
qtest: qtest-df qtest-sqlite qtest-postgres qtest-mssql qtest-duckdb qtest-maria
qtest: qtest-df qtest-sqlite qtest-postgres qtest-mssql qtest-duckdb qtest-maria qtest-mysql

# Progress tests
test: test-df test-sqlite test-postgres test-mssql test-duckdb test-maria
test: test-df test-sqlite test-postgres test-mssql test-duckdb test-maria test-mysql

# Testing with lazytest
ltest: ltest-df ltest-sqlite ltest-postgres ltest-mssql ltest-duckdb ltest-maria
ltest: ltest-df ltest-sqlite ltest-postgres ltest-mssql ltest-duckdb ltest-maria ltest-mysql

# Silent testing
stest: stest-df stest-sqlite stest-postgres stest-mssql stest-duckdb stest-maria
stest: stest-df stest-sqlite stest-postgres stest-mssql stest-duckdb stest-maria stest-mysql

# Connectivity tests
connect: connect-sqlite connect-postgres connect-mssql connect-duckdb connect-maria
connect: connect-sqlite connect-postgres connect-mssql connect-duckdb connect-maria connect-mysql

qtest-%:
DM_TEST_SRC=$@ time R -q -e 'options("crayon.enabled" = TRUE); Sys.setenv(TESTTHAT_PARALLEL = FALSE); testthat::test_local(filter = "${DM_TEST_FILTER}")'
@@ -32,10 +32,20 @@ ltest-%:
connect-%:
DM_TEST_SRC=$@ R -q -e 'suppressMessages(pkgload::load_all()); my_test_con()'

db-init-maria:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_maria(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_maria()$$con, "FLUSH PRIVILEGES")'; do sleep 1; done

db-init-mysql:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mysql(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_mysql()$$con, "FLUSH PRIVILEGES")'; do sleep 1; done

db-init-mssql:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")'; do sleep 1; done

db-init: db-init-maria db-init-mysql db-init-mssql

db-start:
docker-compose up -d --force-recreate
R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_maria(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_maria()$$con, "FLUSH PRIVILEGES")'
R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")'
docker-compose up -d --force-recreate --wait
$(MAKE) db-init

db-restart:
docker-compose up -d
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -6,17 +6,20 @@ volumes:
driver: local
maria-db:
driver: local
mysql-db:
driver: local
services:
# https://www.beekeeperstudio.io/blog/how-to-use-mariadb-with-docker
mysql:
# FIXME: Still need to add Makefile rules to provision MySQL database
container_name: mysql
image: mysql
environment:
MYSQL_ROOT_PASSWORD: "YourStrong!Passw0rd"
MYSQL_DATABASE: test
MYSQL_USER: compose
MYSQL_PASSWORD: "YourStrong!Passw0rd"
volumes:
- mysql-db:/var/lib/mysql
ports:
- "3307:3306"
maria:
91 changes: 8 additions & 83 deletions tests/testthat/_snaps/add-tbl.md
Original file line number Diff line number Diff line change
@@ -7,87 +7,12 @@
`dm_add_tbl()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
i Use `.name_repair = "unique"` if necessary.
Error in `abort_need_unique_names()`:
! Each new table needs to have a unique name. Duplicate new name(s): `tf_1`.

---

Code
dm_add_tbl(dm_for_flatten(), res_flat = result_from_flatten()) %>% dm_paste(
options = c("select", "keys"))
Condition
Warning:
`dm_add_tbl()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
i Use `.name_repair = "unique"` if necessary.
Message
dm::dm(
fact,
dim_1,
dim_2,
dim_3,
dim_4,
res_flat,
) %>%
dm::dm_select(fact, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_1, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2, dim_2_pk, something) %>%
dm::dm_select(dim_3, dim_3_pk, something) %>%
dm::dm_select(dim_4, dim_4_pk, something) %>%
dm::dm_select(res_flat, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, fact.something, dim_1.something, dim_2.something, dim_3.something, dim_4.something) %>%
dm::dm_add_pk(dim_1, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2, dim_2_pk) %>%
dm::dm_add_pk(dim_3, dim_3_pk) %>%
dm::dm_add_pk(dim_4, dim_4_pk) %>%
dm::dm_add_fk(fact, c(dim_1_key_1, dim_1_key_2), dim_1) %>%
dm::dm_add_fk(fact, dim_2_key, dim_2) %>%
dm::dm_add_fk(fact, dim_3_key, dim_3) %>%
dm::dm_add_fk(fact, dim_4_key, dim_4)

# dm_rm_tbl() snapshot

Code
dm_rm_tbl(dm_for_flatten(), dim_1) %>% dm_paste(options = c("select", "keys"))
Condition
Warning:
`dm_rm_tbl()` was deprecated in dm 1.0.0.
i Please use `dm_select_tbl()` instead.
Message
dm::dm(
fact,
dim_2,
dim_3,
dim_4,
) %>%
dm::dm_select(fact, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_2, dim_2_pk, something) %>%
dm::dm_select(dim_3, dim_3_pk, something) %>%
dm::dm_select(dim_4, dim_4_pk, something) %>%
dm::dm_add_pk(dim_2, dim_2_pk) %>%
dm::dm_add_pk(dim_3, dim_3_pk) %>%
dm::dm_add_pk(dim_4, dim_4_pk) %>%
dm::dm_add_fk(fact, dim_2_key, dim_2) %>%
dm::dm_add_fk(fact, dim_3_key, dim_3) %>%
dm::dm_add_fk(fact, dim_4_key, dim_4)
Code
dm_rm_tbl(dm_for_flatten(), fact) %>% dm_paste(options = c("select", "keys"))
Condition
Warning:
`dm_rm_tbl()` was deprecated in dm 1.0.0.
i Please use `dm_select_tbl()` instead.
Message
dm::dm(
dim_1,
dim_2,
dim_3,
dim_4,
) %>%
dm::dm_select(dim_1, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2, dim_2_pk, something) %>%
dm::dm_select(dim_3, dim_3_pk, something) %>%
dm::dm_select(dim_4, dim_4_pk, something) %>%
dm::dm_add_pk(dim_1, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2, dim_2_pk) %>%
dm::dm_add_pk(dim_3, dim_3_pk) %>%
dm::dm_add_pk(dim_4, dim_4_pk)
Warning in `dm_for_filter()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

282 changes: 15 additions & 267 deletions tests/testthat/_snaps/bind.md
Original file line number Diff line number Diff line change
@@ -6,15 +6,14 @@
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Error in `dm_bind()`:
! Names must be unique.
x These names are duplicated:
* "tf_1" at locations 1 and 12.
* "tf_2" at locations 2 and 13.
* "tf_3" at locations 3 and 14.
* "tf_4" at locations 4 and 15.
* "tf_5" at locations 5 and 16.
* ...
Warning in `dm_for_filter()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

# test error output for src mismatches

@@ -25,263 +24,12 @@
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Warning in `dm_for_flatten()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Output
All `dm` objects need to share the same `src`.

# output

Code
dm_bind()
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Output
dm()
Code
dm_bind(empty_dm())
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Output
dm()
Code
dm_bind(dm_for_filter()) %>% collect()
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Output
-- Metadata --------------------------------------------------------------------
Tables: `tf_1`, `tf_2`, `tf_3`, `tf_4`, `tf_5`, `tf_6`
Columns: 20
Primary keys: 6
Foreign keys: 5
Code
dm_bind(dm_for_filter(), dm_for_flatten(), dm_for_filter(), repair = "unique",
quiet = TRUE) %>% collect()
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Output
-- Metadata --------------------------------------------------------------------
Tables: `tf_1...1`, `tf_2...2`, `tf_3...3`, `tf_4...4`, `tf_5...5`, ... (17 total)
Columns: 56
Primary keys: 16
Foreign keys: 14
Code
writeLines(conditionMessage(expect_error(dm_bind(dm_for_filter(),
dm_for_flatten(), dm_for_filter()))))
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Output
Names must be unique.
x These names are duplicated:
* "tf_1" at locations 1 and 12.
* "tf_2" at locations 2 and 13.
* "tf_3" at locations 3 and 14.
* "tf_4" at locations 4 and 15.
* "tf_5" at locations 5 and 16.
* ...

---

Code
dm_bind(dm_for_filter(), dm_for_flatten(), dm_for_filter(), repair = "unique") %>%
collect()
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Message
New names:
* `tf_1` -> `tf_1...1`
* `tf_2` -> `tf_2...2`
* `tf_3` -> `tf_3...3`
* `tf_4` -> `tf_4...4`
* `tf_5` -> `tf_5...5`
* `tf_6` -> `tf_6...6`
* `tf_1` -> `tf_1...12`
* `tf_2` -> `tf_2...13`
* `tf_3` -> `tf_3...14`
* `tf_4` -> `tf_4...15`
* `tf_5` -> `tf_5...16`
* `tf_6` -> `tf_6...17`
Output
-- Metadata --------------------------------------------------------------------
Tables: `tf_1...1`, `tf_2...2`, `tf_3...3`, `tf_4...4`, `tf_5...5`, ... (17 total)
Columns: 56
Primary keys: 16
Foreign keys: 14

# output for compound keys

Code
dm_bind(dm_for_filter(), dm_for_flatten()) %>% dm_paste(options = c("select",
"keys"))
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Message
dm::dm(
tf_1,
tf_2,
tf_3,
tf_4,
tf_5,
tf_6,
fact,
dim_1,
dim_2,
dim_3,
dim_4,
) %>%
dm::dm_select(tf_1, a, b) %>%
dm::dm_select(tf_2, c, d, e, e1) %>%
dm::dm_select(tf_3, f, f1, g) %>%
dm::dm_select(tf_4, h, i, j, j1) %>%
dm::dm_select(tf_5, ww, k, l, m) %>%
dm::dm_select(tf_6, zz, n, o) %>%
dm::dm_select(fact, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_1, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2, dim_2_pk, something) %>%
dm::dm_select(dim_3, dim_3_pk, something) %>%
dm::dm_select(dim_4, dim_4_pk, something) %>%
dm::dm_add_pk(tf_1, a, autoincrement = TRUE) %>%
dm::dm_add_pk(tf_2, c) %>%
dm::dm_add_pk(tf_3, c(f, f1)) %>%
dm::dm_add_pk(tf_4, h) %>%
dm::dm_add_pk(tf_5, k) %>%
dm::dm_add_pk(tf_6, o) %>%
dm::dm_add_pk(dim_1, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2, dim_2_pk) %>%
dm::dm_add_pk(dim_3, dim_3_pk) %>%
dm::dm_add_pk(dim_4, dim_4_pk) %>%
dm::dm_add_uk(tf_3, g) %>%
dm::dm_add_fk(tf_2, d, tf_1) %>%
dm::dm_add_fk(tf_2, c(e, e1), tf_3) %>%
dm::dm_add_fk(tf_4, c(j, j1), tf_3) %>%
dm::dm_add_fk(tf_5, l, tf_4, on_delete = "cascade") %>%
dm::dm_add_fk(tf_5, m, tf_6, n) %>%
dm::dm_add_fk(fact, c(dim_1_key_1, dim_1_key_2), dim_1) %>%
dm::dm_add_fk(fact, dim_2_key, dim_2) %>%
dm::dm_add_fk(fact, dim_3_key, dim_3) %>%
dm::dm_add_fk(fact, dim_4_key, dim_4)
Code
dm_bind(dm_for_flatten(), dm_for_filter()) %>% dm_paste(options = c("select",
"keys"))
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Message
dm::dm(
fact,
dim_1,
dim_2,
dim_3,
dim_4,
tf_1,
tf_2,
tf_3,
tf_4,
tf_5,
tf_6,
) %>%
dm::dm_select(fact, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_1, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2, dim_2_pk, something) %>%
dm::dm_select(dim_3, dim_3_pk, something) %>%
dm::dm_select(dim_4, dim_4_pk, something) %>%
dm::dm_select(tf_1, a, b) %>%
dm::dm_select(tf_2, c, d, e, e1) %>%
dm::dm_select(tf_3, f, f1, g) %>%
dm::dm_select(tf_4, h, i, j, j1) %>%
dm::dm_select(tf_5, ww, k, l, m) %>%
dm::dm_select(tf_6, zz, n, o) %>%
dm::dm_add_pk(dim_1, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2, dim_2_pk) %>%
dm::dm_add_pk(dim_3, dim_3_pk) %>%
dm::dm_add_pk(dim_4, dim_4_pk) %>%
dm::dm_add_pk(tf_1, a, autoincrement = TRUE) %>%
dm::dm_add_pk(tf_2, c) %>%
dm::dm_add_pk(tf_3, c(f, f1)) %>%
dm::dm_add_pk(tf_4, h) %>%
dm::dm_add_pk(tf_5, k) %>%
dm::dm_add_pk(tf_6, o) %>%
dm::dm_add_uk(tf_3, g) %>%
dm::dm_add_fk(fact, c(dim_1_key_1, dim_1_key_2), dim_1) %>%
dm::dm_add_fk(fact, dim_2_key, dim_2) %>%
dm::dm_add_fk(fact, dim_3_key, dim_3) %>%
dm::dm_add_fk(fact, dim_4_key, dim_4) %>%
dm::dm_add_fk(tf_2, d, tf_1) %>%
dm::dm_add_fk(tf_2, c(e, e1), tf_3) %>%
dm::dm_add_fk(tf_4, c(j, j1), tf_3) %>%
dm::dm_add_fk(tf_5, l, tf_4, on_delete = "cascade") %>%
dm::dm_add_fk(tf_5, m, tf_6, n)

---

Code
dm_bind(dm_for_flatten(), dm_for_flatten(), repair = "unique") %>% dm_paste(
options = c("select", "keys"))
Condition
Warning:
`dm_bind()` was deprecated in dm 1.0.0.
i Please use `dm()` instead.
Message
New names:
* `fact` -> `fact...1`
* `dim_1` -> `dim_1...2`
* `dim_2` -> `dim_2...3`
* `dim_3` -> `dim_3...4`
* `dim_4` -> `dim_4...5`
* `fact` -> `fact...6`
* `dim_1` -> `dim_1...7`
* `dim_2` -> `dim_2...8`
* `dim_3` -> `dim_3...9`
* `dim_4` -> `dim_4...10`
dm::dm(
fact...1,
dim_1...2,
dim_2...3,
dim_3...4,
dim_4...5,
fact...6,
dim_1...7,
dim_2...8,
dim_3...9,
dim_4...10,
) %>%
dm::dm_select(fact...1, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_1...2, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2...3, dim_2_pk, something) %>%
dm::dm_select(dim_3...4, dim_3_pk, something) %>%
dm::dm_select(dim_4...5, dim_4_pk, something) %>%
dm::dm_select(fact...6, fact, dim_1_key_1, dim_1_key_2, dim_2_key, dim_3_key, dim_4_key, something) %>%
dm::dm_select(dim_1...7, dim_1_pk_1, dim_1_pk_2, something) %>%
dm::dm_select(dim_2...8, dim_2_pk, something) %>%
dm::dm_select(dim_3...9, dim_3_pk, something) %>%
dm::dm_select(dim_4...10, dim_4_pk, something) %>%
dm::dm_add_pk(dim_1...2, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2...3, dim_2_pk) %>%
dm::dm_add_pk(dim_3...4, dim_3_pk) %>%
dm::dm_add_pk(dim_4...5, dim_4_pk) %>%
dm::dm_add_pk(dim_1...7, c(dim_1_pk_1, dim_1_pk_2)) %>%
dm::dm_add_pk(dim_2...8, dim_2_pk) %>%
dm::dm_add_pk(dim_3...9, dim_3_pk) %>%
dm::dm_add_pk(dim_4...10, dim_4_pk) %>%
dm::dm_add_fk(fact...1, c(dim_1_key_1, dim_1_key_2), dim_1...2) %>%
dm::dm_add_fk(fact...1, dim_2_key, dim_2...3) %>%
dm::dm_add_fk(fact...1, dim_3_key, dim_3...4) %>%
dm::dm_add_fk(fact...1, dim_4_key, dim_4...5) %>%
dm::dm_add_fk(fact...6, c(dim_1_key_1, dim_1_key_2), dim_1...7) %>%
dm::dm_add_fk(fact...6, dim_2_key, dim_2...8) %>%
dm::dm_add_fk(fact...6, dim_3_key, dim_3...9) %>%
dm::dm_add_fk(fact...6, dim_4_key, dim_4...10)
Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

847 changes: 40 additions & 807 deletions tests/testthat/_snaps/dm.md

Large diffs are not rendered by default.

528 changes: 0 additions & 528 deletions tests/testthat/_snaps/dplyr.md

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions tests/testthat/_snaps/error-helpers.md
Original file line number Diff line number Diff line change
@@ -65,9 +65,14 @@
Code
abort_no_cycles(create_graph_from_dm(dm_for_filter_w_cycle()))
Condition
Error in `abort_no_cycles()`:
! Cycles in the relationship graph not yet supported.
i Shortest cycle: tf_5 -> tf_6 -> tf_7 -> tf_2 -> tf_3 -> tf_4 -> tf_5
Warning in `dm_for_filter_w_cycle()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Code
abort_tables_not_reachable_from_start()
Condition
245 changes: 1 addition & 244 deletions tests/testthat/_snaps/foreign-keys.md
Original file line number Diff line number Diff line change
@@ -1,210 +1,3 @@
# dm_add_fk() works as intended?

Code
dm_test_obj() %>% dm_add_pk(dm_table_4, c) %>% dm_add_fk(dm_table_1, a,
dm_table_4) %>% get_all_keys()
Output
$pks
# A tibble: 1 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 dm_table_4 c FALSE
$fks
# A tibble: 1 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 dm_table_1 a dm_table_4 c no_action

# dm_rm_fk() works with partial matching

Code
dm_for_filter() %>% dm_rm_fk(tf_5) %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_5, l, tf_4) %>%
dm_rm_fk(tf_5, m, tf_6, n))
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 3 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
Code
dm_for_filter() %>% dm_rm_fk(columns = l) %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_5, l, tf_4)
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 4 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_fk(columns = c(e, e1)) %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_2, c(e, e1), tf_3)
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 4 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_4 j, j1 tf_3 f, f1 no_action
3 tf_5 l tf_4 h cascade
4 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_fk(ref_table = tf_3) %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_2, c(e, e1), tf_3) %>%
dm_rm_fk(tf_4, c(j, j1), tf_3)
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 3 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_5 l tf_4 h cascade
3 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_fk(ref_columns = c(f, f1)) %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_2, c(e, e1), tf_3) %>%
dm_rm_fk(tf_4, c(j, j1), tf_3)
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 3 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_5 l tf_4 h cascade
3 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_fk() %>% get_all_keys()
Message
Removing foreign keys: %>%
dm_rm_fk(tf_2, d, tf_1) %>%
dm_rm_fk(tf_2, c(e, e1), tf_3) %>%
dm_rm_fk(tf_4, c(j, j1), tf_3) %>%
dm_rm_fk(tf_5, l, tf_4) %>%
dm_rm_fk(tf_5, m, tf_6, n))
Output
$pks
# A tibble: 6 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
6 tf_6 o FALSE
$fks
# A tibble: 0 x 5
# i 5 variables: child_table <chr>, child_fk_cols <keys>, parent_table <chr>,
# parent_key_cols <keys>, on_delete <chr>

# dm_enum_fk_candidates() works as intended?

Code
dm_nycflights13() %>% dm_enum_fk_candidates(flights, airports) %>% mutate(why = if_else(
why != "", "<reason>", ""))
Output
# A tibble: 19 x 3
columns candidate why
<keys> <lgl> <chr>
1 origin TRUE ""
2 year FALSE "<reason>"
3 month FALSE "<reason>"
4 day FALSE "<reason>"
5 dep_time FALSE "<reason>"
6 sched_dep_time FALSE "<reason>"
7 dep_delay FALSE "<reason>"
8 arr_time FALSE "<reason>"
9 sched_arr_time FALSE "<reason>"
10 arr_delay FALSE "<reason>"
11 carrier FALSE "<reason>"
12 flight FALSE "<reason>"
13 tailnum FALSE "<reason>"
14 dest FALSE "<reason>"
15 air_time FALSE "<reason>"
16 distance FALSE "<reason>"
17 hour FALSE "<reason>"
18 minute FALSE "<reason>"
19 time_hour FALSE "<reason>"

# can add foreign key with cascade

Code
@@ -229,43 +22,7 @@
Error in `dm_add_fk()`:
! `on_delete` must be one of "no_action" or "cascade", not "a".

# dm_get_all_fks() with parent_table arg

Code
nyc_comp() %>% dm_get_all_fks(weather)
Output
# A tibble: 1 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 flights origin, time_hour weather origin, time_hour no_action
Code
nyc_comp() %>% dm_get_all_fks(c("airlines", "weather"))
Output
# A tibble: 2 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 flights carrier airlines carrier no_action
2 flights origin, time_hour weather origin, time_hour no_action
Code
nyc_comp() %>% dm_get_all_fks(ends_with("ports"))
Output
# A tibble: 1 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 flights dest airports faa no_action
Code
nyc_comp() %>% dm_get_all_fks(everything())
Output
# A tibble: 4 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 flights carrier airlines carrier no_action
2 flights dest airports faa no_action
3 flights tailnum planes tailnum no_action
4 flights origin, time_hour weather origin, time_hour no_action

# dm_get_all_fks() with parent_table arg fails nicely

Can't subset tables that don't exist.
x Table `timetable` doesn't exist.
Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

71 changes: 22 additions & 49 deletions tests/testthat/_snaps/key-helpers.md
Original file line number Diff line number Diff line change
@@ -14,70 +14,43 @@
The `.data` argument of `check_key()` is deprecated as of dm 1.0.0.
i Please use the `x` argument instead.

# output for legacy API

Code
check_subset(data_mcard_1(), a, data_mcard_2(), a)
Condition
Warning:
The `c1` argument of `check_subset()` is deprecated as of dm 1.0.0.
i Please use the `x_select` argument instead.
i Use `y_select` instead of `c2`, and `x` and `y` instead of `t1` and `t2`.
i Using `by_position = TRUE` for compatibility.

# output

Code
check_subset(data_mcard_1(), data_mcard_2(), x_select = c(x = a))
Condition
Error in `check_api_impl()`:
! `by_position = FALSE` or `by_position = NULL` require column names in `x` to match those in `y`.
Warning in `data_mcard_1()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

---

Code
check_subset(data_mcard_2(), data_mcard_1(), x_select = a)
Output
# A tibble: 1 x 1
a
<dbl>
1 3
Condition
Error in `abort_not_subset_of()`:
! Column (`a`) of table `data_mcard_2()` contains values (see examples above) that are not present in column (`a`) of table `data_mcard_1()`.
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

# output for compound keys

Code
check_subset(data_mcard_2(), data_mcard_1(), x_select = c(a, b))
Output
# A tibble: 3 x 2
a b
<dbl> <dbl>
1 1 4
2 2 5
3 3 6
Condition
Error in `abort_not_subset_of()`:
! Columns (`a`, `b`) of table `data_mcard_2()` contain values (see examples above) that are not present in columns (`a`, `b`) of table `data_mcard_1()`.

# check_set_equality() checks properly if 2 sets of values are equal?

Code
check_set_equality(data_mcard_1(), data_mcard_2(), x_select = c(a, c))
Output
# A tibble: 2 x 2
a c
<dbl> <dbl>
1 1 5
2 2 6
# A tibble: 2 x 2
a c
<dbl> <dbl>
1 2 8
2 3 9
Condition
Error in `abort_sets_not_equal()`:
! Columns (`a`, `c`) of table `data_mcard_1()` contain values (see examples above) that are not present in columns (`a`, `c`) of table `data_mcard_2()`.
Columns (`a`, `c`) of table `data_mcard_2()` contain values (see examples above) that are not present in columns (`a`, `c`) of table `data_mcard_1()`.
Warning in `data_mcard_2()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

5 changes: 5 additions & 0 deletions tests/testthat/_snaps/mysql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dummy

Code
# dummy

277 changes: 1 addition & 276 deletions tests/testthat/_snaps/primary-keys.md
Original file line number Diff line number Diff line change
@@ -1,223 +1,3 @@
# dm_add_pk() works as intended?

Code
dm(x = tibble(x = integer())) %>% dm_add_pk(x)
Condition
Error in `dm_add_pk()`:
! `columns` is absent but must be supplied.

# dm_rm_pk() supports partial filters

Code
dm_for_filter() %>% dm_rm_pk(tf_4) %>% get_all_keys()
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_5 k FALSE
5 tf_6 o FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(tf_3) %>% get_all_keys()
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_4 h FALSE
4 tf_5 k FALSE
5 tf_6 o FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(tf_6) %>% get_all_keys()
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_4 h FALSE
5 tf_5 k FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(tf_4, rm_referencing_fks = TRUE) %>% get_all_keys()
Condition
Warning:
The `rm_referencing_fks` argument of `dm_rm_pk()` is deprecated as of dm 0.2.1.
i When removing a primary key, potential associated foreign keys will be pointing at an implicit unique key.
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_3 f, f1 FALSE
4 tf_5 k FALSE
5 tf_6 o FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(columns = c) %>% get_all_keys()
Message
Removing primary keys: %>%
dm_rm_pk(tf_2)
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_3 f, f1 FALSE
3 tf_4 h FALSE
4 tf_5 k FALSE
5 tf_6 o FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(columns = c(f, f1)) %>% get_all_keys()
Message
Removing primary keys: %>%
dm_rm_pk(tf_3)
Output
$pks
# A tibble: 5 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 tf_1 a TRUE
2 tf_2 c FALSE
3 tf_4 h FALSE
4 tf_5 k FALSE
5 tf_6 o FALSE
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action
Code
dm_for_filter() %>% dm_rm_pk(fail_fk = FALSE) %>% get_all_keys()
Condition
Warning:
The `fail_fk` argument of `dm_rm_pk()` is deprecated as of dm 1.0.4.
i When removing a primary key, potential associated foreign keys will be pointing at an implicit unique key.
Message
Removing primary keys: %>%
dm_rm_pk(tf_1) %>%
dm_rm_pk(tf_2) %>%
dm_rm_pk(tf_3) %>%
dm_rm_pk(tf_4) %>%
dm_rm_pk(tf_5) %>%
dm_rm_pk(tf_6)
Output
$pks
# A tibble: 0 x 3
# i 3 variables: table <chr>, pk_col <keys>, autoincrement <lgl>
$fks
# A tibble: 5 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_2 e, e1 tf_3 f, f1 no_action
3 tf_4 j, j1 tf_3 f, f1 no_action
4 tf_5 l tf_4 h cascade
5 tf_5 m tf_6 n no_action

# dm_enum_pk_candidates() works properly?

Code
dm_enum_pk_candidates(dm_test_obj(), dm_table_1)
Output
# A tibble: 2 x 3
columns candidate why
<keys> <lgl> <chr>
1 a TRUE ""
2 b TRUE ""
Code
dm_enum_pk_candidates(dm_test_obj(), dm_table_2)
Output
# A tibble: 1 x 3
columns candidate why
<keys> <lgl> <chr>
1 c FALSE has duplicate values: 5 (2)
Code
dm_enum_pk_candidates(dm_test_obj(), dm_table_5)
Output
# A tibble: 1 x 3
columns candidate why
<keys> <lgl> <chr>
1 c FALSE has 1 missing values
Code
dm_enum_pk_candidates(dm_test_obj(), dm_table_6)
Output
# A tibble: 1 x 3
columns candidate why
<keys> <lgl> <chr>
1 c FALSE has 1 missing values, and duplicate values: 3 (2)

# output

Code
@@ -226,64 +6,9 @@
Error in `abort_not_unique_key()`:
! (`a`) not a unique key of `x`.

# dm_get_all_pks() with table arg

Code
nyc_comp() %>% dm_get_all_pks("weather")
Output
# A tibble: 1 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 weather origin, time_hour FALSE
Code
nyc_comp() %>% dm_get_all_pks(c(airlines, weather))
Output
# A tibble: 2 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 airlines carrier FALSE
2 weather origin, time_hour FALSE
Code
nyc_comp() %>% dm_get_all_pks(starts_with("weat"))
Output
# A tibble: 1 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 weather origin, time_hour FALSE
Code
nyc_comp() %>% dm_get_all_pks(matches("^a.*s$"))
Output
# A tibble: 2 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 airlines carrier FALSE
2 airports faa FALSE

# dm_get_all_pks() with table arg fails nicely

Can't subset tables that don't exist.
x Table `timetable` doesn't exist.

# dm_get_all_pks() with compound keys

Code
nyc_comp()
Output
-- Metadata --------------------------------------------------------------------
Tables: `airlines`, `airports`, `flights`, `planes`, `weather`
Columns: 53
Primary keys: 4
Foreign keys: 4
Code
nyc_comp() %>% dm_get_all_pks()
Output
# A tibble: 4 x 3
table pk_col autoincrement
<chr> <keys> <lgl>
1 airlines carrier FALSE
2 airports faa FALSE
3 planes tailnum FALSE
4 weather origin, time_hour FALSE
Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

# autoincrement fails with compound keys

22 changes: 16 additions & 6 deletions tests/testthat/_snaps/tidyselect.md
Original file line number Diff line number Diff line change
@@ -3,13 +3,23 @@
Code
dm_for_filter() %>% dm_select_tbl(tf_7)
Condition
Error in `eval_select_indices()`:
! Can't subset tables that don't exist.
x Table `tf_7` doesn't exist.
Warning in `dm_for_filter()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Code
dm_for_filter() %>% dm_rename_tbl(tf_0 = tf_7)
Condition
Error in `eval_rename_indices()`:
! Can't rename tables that don't exist.
x Table `tf_7` doesn't exist.
Warning in `dm_for_filter()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Warning in `my_test_src_cache()`:
restarting interrupted promise evaluation
Error in `value[[3L]]()`:
! Data source mysql not accessible: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

17 changes: 17 additions & 0 deletions tests/testthat/helper-config-db.R
Original file line number Diff line number Diff line change
@@ -45,6 +45,23 @@ test_src_maria <- function(root = FALSE) {
dbplyr::src_dbi(con, auto_disconnect = TRUE)
}

test_src_mysql <- function(root = FALSE) {
if (Sys.getenv("DM_TEST_DOCKER_HOST") != "") {
con <- DBI::dbConnect(
RMariaDB::MariaDB(),
host = Sys.getenv("DM_TEST_DOCKER_HOST"),
username = if (root) "root" else "compose",
password = "YourStrong!Passw0rd",
dbname = "test",
port = 3307,
mysql = TRUE
)
} else {
con <- DBI::dbConnect(RMariaDB::MariaDB(), dbname = "test", mysql = TRUE)
}
dbplyr::src_dbi(con, auto_disconnect = TRUE)
}

test_src_mssql <- function(database = TRUE) {
if (Sys.getenv("DM_TEST_DOCKER_HOST") != "") {
con <- DBI::dbConnect(
1 change: 1 addition & 0 deletions tests/testthat/helper-sync.R
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ local({
sources <- c(
"duckdb",
"maria",
"mysql",
"mssql",
"postgres",
"sqlite",
28 changes: 28 additions & 0 deletions tests/testthat/test-mysql.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
test_that("dummy", {
expect_snapshot({
"dummy"
})
})

test_that("dm_sql()", {
# Need skip in every test block, unfortunately
skip_if_src_not("mysql")

# https://github.com/tidyverse/dbplyr/pull/1190
skip_if(is(my_test_con(), "MySQLConnection") && packageVersion("dbplyr") < "2.4.0")

expect_snapshot({
dm_for_filter_df() %>%
dm_sql(my_test_con())
})

expect_snapshot({
dm(x = data.frame(a = strrep("x", 300))) %>%
dm_sql(my_test_con())
})

expect_snapshot({
dm(x = data.frame(a = strrep("x", 10000))) %>%
dm_sql(my_test_con())
})
})