pymysql에서 blob column에 Insert하는 방법
import pymysql conn = pymysql.connect(host='host name or ip',user='user name',passwd='password',db='db name',charset='db의 charset') cur = conn.cursor() sql = 'insert into t1(c1,c2,c3) values(%s,%s,%s)' with open(filename, 'rb') as file: binaryData = file.read() #c1은 int, c2는 varchar(10), c3는 blob일 때 args = (1,'text',binaryData) cur.execute(sql,args) conn.commit() conn.close()
프로그래밍/Python
2022. 2. 15. 18:44
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- F21VDN
- OLED64B9CNA
- libsystemd
- packet sequence number wrong
- F21VDZ
- pymysql
- F21VDD
- OLED
- column 추가
- max size
- OLED64B9BNA
- MariaDB
- F21VDV
- 캐시몽
- 헤이플
- F21VDU
- 앱테크
- F21VDT
- 고래문화마을
- OLED65B9
- 최대 크기
- insert column
- lgtv
- blob
- Ubuntu 14.04
- mediumblob
- OLED65B9GNA
- F21VBT
- longblob
- LG티비
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함