본문 바로가기

전체 글819

SQLAlchemy _ add() 와 add_all() 사용법과 차이점 add()와 add_all() add()와 add_all() 은 sqlalchemy session의 메서드로서 DB에 데이터를 넣을 때 사용합니다. 메서드의 이름에서 보면 알다시피 add는 단일 insert이고 add_all 은 bulk insert입니다. 오늘은 이 둘의 사용법에 대해서 알아보겠습니다. add() 여기 3개의 이름을 DB에 넣어야 한다고 해봅시다. 3개의 데이터는 각각 첫 번째 요소가 id, 두 번째 요소가 이름입니다. names = [ [1, "변덕순"], [2, "장득현"], [3, "고문용"], ] 이를 add()로 넣는다면 다음과 같은 코드를 작성할 수 있습니다. ('Name'은 model class입니다) names = [ [1, "변덕순"], [2, "장득현"], [3, "고.. 2022. 5. 2.
Today log는 회사 '업무일지'로 대체합니다. 회사에서 매일 업무일지를 작성하므로 기존 today log는 블로그에 올리지 않습니다 :) 2022. 5. 1.
2022년 17-18주차 '월간 사이드 프로젝트 시작' Weekly growth 지난 주말 집에서 늘어지는 바람에 이번 주는 2주를 함께 회고하겠습니다. ㅜㅠ 앞으로 주말에 늘어지지 않도록 환경설정하겠습니다.. (카페, 모임 등 외출하기) TIL 2주 간 10개의 til을 작성했습니다. 보통 취업을 하면 블로그를 소홀히하는 경우를 많이 보았는데요. 저는 꾸준한 개발자가 되고 싶어 계속 til을 쓰려고 합니다. '매일 하겠다.' 이런 약속은 하지 않겠습니다. 그저 가능한 선에서 til을 쓰도록 하겠습니다. 2022.04.29 - [Dev/Debug] - SQLAlchemy _ NotSupportedError(InvalidCachedStatementError) 에러 해결 2022.04.28 - [Dev/Language] - Python _ 런타임 중에 스크립트 .. 2022. 5. 1.
Find the vowels We want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters). So given a string "super", we should return a list of [2, 4]. Some examples: Mmmm => [] Super => [2,4] Apple => [1,5] YoMama -> [1,2,4,6] NOTES Vowels in this context refers to: a e i o u y (including upper case) This is indexed from [1..n] (not zero index.. 2022. 5. 1.
Odd or Even? Task: Given a list of integers, determine whether the sum of its elements is odd or even. Give your answer as a string matching "odd" or "even". If the input array is empty consider it as: [0] (array with a zero). Examples: Input: [0] Output: "even" Input: [0, 1, 4] Output: "odd" Input: [0, -1, -5] Output: "even" Have fun! Solution: 1. Check if the sum of the array is odd. 2. If true, return "od.. 2022. 4. 30.
Sort array by string length Description: Write a function that takes an array of strings as an argument and returns a sorted array containing the same strings, ordered from shortest to longest. For example, if this array were passed as an argument: ["Telescopes", "Glasses", "Eyes", "Monocles"] Your function would return the following array: ["Eyes", "Glasses", "Monocles", "Telescopes"] All of the strings in the array passe.. 2022. 4. 29.