Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- call select_all_exclude_one('vegas', 'uniqueIdentifier', @exclude_fields);
- set @file_input = 'C:/MRTK_Enigma_IRD_VegaOSWP_New_Format.csv' ;
- set @field_terminate = '|';
- set @line_terminate = '\n';
- set @date_format = '%Y%m%d %H:%i:%s';
- set @columns_input = 'deskCode, bookName, riskType, riskTypeShiftSizeInBP, productCode, currency,
- maturity, maturityUnderlying, riskValue, currencyRiskValue,
- issuerCategory, countryOfIssuer, ratingCategory, postDate,
- @the_date, strike, currencyBase, indexCategory, EOL';
- set @sql = concat('LOAD DATA INFILE ''', @file_input, '''
- IGNORE
- INTO TABLE skewrisk.vegas
- FIELDS TERMINATED BY ''', @field_terminate, '''
- LINES TERMINATED BY ''', @line_terminate, '''
- IGNORE 1 LINES n(', @columns_input,
- ')nset lastUpdate = str_to_date(@the_date, ''', @date_format, '''),
- uniqueIdentifier = MD5(concat(', @exclude_fields, '))');
- select @sql;
- prepare stmt from @sql;
- execute stmt;
- Action: prepare stmt from @sql
- Message: Error Code: 1295. This command is not supported in the prepared statement protocol yet
- ALTER TABLE skewrisk.vegas ADD UNIQUE (
- deskCode, bookName, riskType, riskTypeShiftSizeInBP, productCode, currency,
- maturity, maturityUnderlying, riskValue, currencyRiskValue,
- issuerCategory, countryOfIssuer, ratingCategory, postDate,
- strike, currencyBase, indexCategory, EOL, lastUpdate
- );
- LOAD DATA LOCAL INFILE 'file'
- INTO TABLE table_name
- FIELDS TERMINATED BY ','
- OPTIONALLY ENCLOSED BY '"'
- LINES TERMINATED BY '\r\n'
- (unique_id, date, col1, col2, ... )
- SET unique_id = CONCAT(date,col1,col2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement