I would like to include a user variable in the MySQL `LOAD DATA LOCAL INFILE' file path. Our small team often accesses raw data files from Dropbox, so everyone has to find/replace the user name in the path definitions.
I was expecting the following to work but keep getting syntax errors:
SET @USER := 'user';
SET sql_mode='PIPES_AS_CONCAT';
LOAD DATA LOCAL
INFILE '/Users/' || @USER || '/Dropbox/Data/data.csv'
Also fails with CONCAT()
. Any ideas? Thanks!
Similar questions asked here: Load data Infile @variable into infile error but without accepted answer.