Python sqlite3.connect()
사용 버전 : Python 3.6.8
사용 프로그램 : Atom 1.36.1 x64
파이썬 sqlite3.connect()에 대해서 알아보겠습니다.
괄호 안에는 '파일 이름' 또는 ':memory:'가 들어갑니다.
sqlite3.connect()는 새로운 DB 파일을 만들거나, 기존의 DB와 연결할 때
사용합니다.
사용 가능한 파일 확장자로는 '.db', '.sqlite', '.sqlite3', '.db3'이 있습니다.
':memory:'의 경우, in-memory database를 만듭니다. 즉, RAM에 데이터베이스를
만듭니다.
파이썬 파일밖에 없는 폴더입니다.




blog.sqlite3이라는 DB가 만들어졌습니다.
이번엔 :memory:를 사용해보겠습니다.



메모리에 생성하기 때문에, 보조 메모리(SSD, HDD)에 저장되지 않습니다.
URI 형식으로 파일을 불러올 수 있습니다.




mode에서 r는 read(읽기), w는 write(쓰기), c는 create(만들기)입니다.
읽기 전용은 ro(read only)를 쓰면 됩니다.
끝.
카테고리: sqlite3, Python
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.