반응형
DataFrame.to_sql 메소드가 있지만 mysql, sqlite 및 oracle 데이터베이스에서만 작동합니다. 이 메서드 postgres 연결 또는 sqlalchemy 엔진으로 전달할 수 없습니다.
해결 방법
from sqlalchemy import create_engine
engine = create_engine('postgresql://scott:tiger@localhost:5432/mydatabase')
df.to_sql('table_name', engine)
import sql # the patched version (file is named sql.py)
sql.write_frame(df, 'table_name', con, flavor='postgresql')
참조 페이지 https://stackoverflow.com/questions/23103962
반응형
'파이썬' 카테고리의 다른 글
파이썬 Parsing HTTP Response in Python (0) | 2020.12.15 |
---|---|
파이썬 Get date and time when photo was taken from EXIF data using PIL (0) | 2020.12.15 |
파이썬으로 BDD 연습하기 (0) | 2020.12.15 |
파이썬에서 행렬 열 합계 (0) | 2020.12.15 |
파이썬에서 두 개의 목록을 수학적으로 빼는 방법은 무엇입니까? (0) | 2020.12.15 |
댓글