简体   繁体   中英

How to insert python list into a column in database

My python list with name final_data_path containes below links, which I need to insert into the other_file_url column in transactions.batch_upload but it is only updating the list name not the links. Refer screenshot below. Please suggest.

[
    "https://link/split/1.csv",
    "https://link/split/2.csv",
    "https://link/split/3.csv",
    "https://link/split/4.csv",
]

here is my query.

UPDATE 
  Transactions.batch_upload 
SET 
  other_file_url = 'final_data_path' 
WHERE 
  batch_upload_id = '23232'

在此处输入图像描述

the length of other_file_url and its Data Type must be in accordance with final_data_path (Python list)

declare @t varchar(max)=(select final_data_path from yourtable)
UPDATE 
  Transactions.batch_upload 
SET 
  other_file_url = @t /*Or following comment query*/
WHERE 
  batch_upload_id = '23232'

or more simply

UPDATE 
  Transactions.batch_upload 
SET 
  other_file_url = (select final_data_path from yourtable)
WHERE 
  batch_upload_id = '23232'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM