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

Option to enable Local Data Loading Capability #385

Closed
GitHunter0 opened this issue Apr 9, 2022 · 2 comments
Closed

Option to enable Local Data Loading Capability #385

GitHunter0 opened this issue Apr 9, 2022 · 2 comments

Comments

@GitHunter0
Copy link

GitHunter0 commented Apr 9, 2022

Hi folks,

By default, MySQL disables Local Data Loading Capability.

So if I try to do something like below, I receive Error: Error executing query: Load data local infile forbidden

  DBI::dbExecute(con,
      r"[
        LOAD DATA LOCAL INFILE <file_path>
        INTO TABLE <table_name>
        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' 
        LINES  TERMINATED BY '\r\n' ;
      ]"
  ) 

In MySQL Workbench, I can enable that by going to "MySQL Connection" -> "Edit Connection..." -> "Advanced" -> "Others:" -> then insert OPT_LOCAL_INFILE=1.
Nonetheless, I can't rely on GUI software like Workbench, I need to build an automated rotine with only R.

Therefore, would you consider adding an option in the DBI connection function to insert configurations like OPT_LOCAL_INFILE=1 ?

Or is there a current workaround to use LOAD DATA LOCAL INFILE via DBI?

Since it is an important feature for my workflow, any feedback will be much appreciated.

PS: Some Python examples with the option explicitly passed to the connection:

import mysql.connector
con = mysql.connector.connect(option_files="my.ini", allow_local_infile=True)
import MYSQLdb
MySQLdb.connect(..., local_infile=True)
@krlmlr
Copy link
Member

krlmlr commented Apr 14, 2022

Thanks. Closing as a duplicate of r-dbi/RMariaDB#265.

@krlmlr krlmlr closed this as completed Apr 14, 2022
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

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

No branches or pull requests

2 participants