Option to enable Local Data Loading Capability
GitHunter0 opened this issue · 2 comments
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)
Thanks. Closing as a duplicate of r-dbi/RMariaDB#265.