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 db_write_table.MySQLConnection #1376

Closed
wants to merge 1 commit into from
Closed

Conversation

kongdd
Copy link

@kongdd kongdd commented Oct 10, 2023

By adding this function, RMySQL will be alive again. I have tested the function of copy_to, compute, collaps, collect, rows_append.

Only one line modified. It seems that table_ident_to_id(table) not work for RMySQL backend. When table_ident_to_id(table) changes to table_name, issue is solved.

@kongdd
Copy link
Author

kongdd commented Oct 10, 2023

This PR will solve the issues of r-dbi/RMySQL#230, tidyverse/dplyr#5329.

@hadley
Copy link
Member

hadley commented Dec 21, 2023

I no longer see much of a performance difference. Are you sure that this is still necessary?

library(DBI)
con_maria <- dbConnect(
  RMariaDB::MariaDB(),
  dbname = "test",
  username = "root",
  password = "",
  load_data_local_infile = TRUE
)
system.time(dbWriteTable(con_maria, "diamonds", ggplot2::diamonds))
#>    user  system elapsed 
#>   0.258   0.059   0.702
dbRemoveTable(con_maria, "diamonds")

Created on 2023-12-21 with reprex v2.0.2.9000

library(DBI)
con_mysql <- dbConnect(
  RMySQL::MySQL(),
  dbname = "test",
  username = "root",
  password = ""
)
system.time(dbWriteTable(con_mysql, "diamonds", ggplot2::diamonds))
#>    user  system elapsed 
#>   0.369   0.018   0.594
dbRemoveTable(con_mysql, "diamonds")
#> [1] TRUE

Created on 2023-12-21 with reprex v2.0.2.9000

@hadley
Copy link
Member

hadley commented Dec 22, 2023

Regardless, after #1396, this will need some changes, and overall I think I'd prefer to figure out how to reduce some of the duplication across backends here. So if it's still a problem for you, please file an issue and I'll tackle it next year.

@hadley hadley closed this Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants