분류 전체보기 (425) 썸네일형 리스트형 [Python] 예외 체이닝: 더 나은 디버깅을 위한 예외 처리 전략 Python의 예외 처리를 조금 더 구조적이고 추적 가능하게 만들기 위한 방법 중 하나가 바로 **예외 체이닝(exception chaining)**입니다. 이 글에서는 raise ... from ... 문법의 동작 원리와 장점에 대해 설명합니다.문제 상황: 예외 원인 추적 불가def parse_token(token): raise ValueError("Invalid token format")def authenticate(token): try: parse_token(token) except ValueError: raise RuntimeError("인증 실패")authenticate("abc")결과:RuntimeError: 인증 실패예외 메시지에는 "인증 실패"만 출.. [SQLAlchemy] ORM 성능 최적화: Lazy Loading vs Eager Loading (feat. 로딩 전략) SQLAlchemy ORM의 로딩 전략 옵션에 대해 알아보자.이 개념은 단순한 옵션 차이를 넘어, 쿼리 성능, 데이터 처리 효율, N+1 문제 발생 여부에 직결된다. - Lazy Loading, Eager Loading 이란?- 실무 예제- 두 방식의 차이- 언제 어떤 방식으로 써야하는가? Lazy Loading이란? (필요할 때 실행)Lazy Loading은 관계가 설정된 객체를 접근할 때마다 별도로 SELECT 쿼리를 실행하는 방식입니다.예제 모델class Author(Base): __tablename__ = 'author' id = Column(Integer, primary_key=True) books = relationship("Book", backref="author")clas.. [SQLAlchemy] 같은 테이블을 참조하는 방법 (Self-Referential Join) 같은 테이블 내에서 다른 레코드를 참조해야 하는 경우가 종종 있습니다.예를 들어, 사용자(user)와 관리자가 모두 동일한 member 테이블에 저장되는 경우, 각 사용자는 관리자 ID를 외래키로 참조하고 있을 수 있습니다.이러한 구조에서 SQLAlchemy를 통해 자기 참조(joining the same table) 를 수행할 때는 몇 가지 주의할 점이 있습니다.기본 테이블 구조예제에서는 관리자가 있는 member 테이블을 사용합니다. 각 member는 선택적으로 admin_id를 가지고 있으며, 이는 같은 테이블 내 다른 member를 참조합니다.from sqlalchemy import Column, Integer, ForeignKeyfrom sqlalchemy.orm import relationsh.. [SQLAlchemy] 윈도우 함수 orm으로 사용 https://docs.sqlalchemy.org/en/20/tutorial/data_select.html#using-window-functions Using SELECT Statements — SQLAlchemy 2.0 Documentation docs.sqlalchemy.orgstmt = ( select( func.row_number().over(partition_by=user_table.c.name), user_table.c.name, address_table.c.email_address, ) .select_from(user_table) .join(address_table))with engine.connect() as conn: r.. [Web] 다른 사이트들의 평균 JS 크기 확인하기 (feat. 웹 서비스 성능 분석) https://httparchive.org/reports/state-of-javascript?start=earliest&end=latest&view=list HTTP Archive: State of JavaScriptJavaScript powers the modern web, enabling rich and interactive web applications. In this report we dive into how JavaScript is used on the web, and its adoption and trends both for mobile and desktop experiences.httparchive.org [Web] 2025.4.22, 구글, 크롬 브라우저 쿠키 삭제 계획 포기 (feat. 쿠키 리스) https://privacysandbox.com/news/privacy-sandbox-next-steps/ Next steps for Privacy Sandbox and tracking protections in ChromeIn this April 2025 announcement, the Privacy Sandbox team shares next steps for Privacy Sandbox and tracking protections in Chrome.privacysandbox.com 결론: Chrome에서 사용자에게 타사 쿠키 선택권을 제공하는 현재 방식을 유지하기로 결정했으며, 타사 쿠키에 대한 새로운 독립형 프롬프트를 출시하지 않을 것입니다. 사용자는 Chrome의 개인정보 보호 및 보안 설정에서.. [찾아봐야하는것] 2025.5 찾아봐야 하는 키워드 & 읽어봐야하는 포스팅 DB하나의 트랜잭션 안에서 DDL과 DML을 함께 써도 될까?https://dkswnkk.tistory.com/767 하나의 트랜잭션 안에서 DDL과 DML을 함께 써도 될까?개요결론부터 말하면 PostgreSQL을 제외한 MySQL, MariaDB, Oracle에서는 트랜잭션 내에서 DDL을 실행하는 순간 그 이전에 수행된 모든 DML이 자동으로 커밋되어 예상치 못한 결과가 나올 수 있으니 작성을dkswnkk.tistory.com99%가 모른다는 DB Connection 누수 문제https://helloworld.kurly.com/blog/connection-leak/ 99%가 모른다는 DB Connection 누수 문제DB Connection과 Garbage Collector의 관계를 중심으로 mys.. [WSL] WSL2 에서 실행한 프로젝트 접속하기 (포트포워딩/방화벽) WSL1은 Windows와 같은 네트워크 스택을 공유하여 아래 설정이 필요없으나,WSL2는 기본적으로 가상 네트워크 인터페이스를 사용한다.즉, WSL에서 실행한 프로젝트에 외부에서 접속하려고 하면 안되는것이다.# version 확인wsl -v WSL2인 경우 아래 절차를 밟으면 외부에서 접속이 가능하다.1. 내 윈도우 ip 확인ipconfig2. wsl 내부 ip 확인wslifconfig 3. wsl2에서 fastapi 구동중인 포트를 윈도우로 포트포워딩명확한 ip를 제시해야하며 0.0.0.0 은 제공하지않는다.netsh interface portproxy add v4tov4 listenport= listenaddress= connectport= connectaddress=netsh interface p.. 이전 1 2 3 4 ··· 54 다음