Programming/Python 9

SQL Alchemy) BEGIN ISOLATION LEVEL READ COMMITTED 이 보이면서 지연이 발생하는 현상

BEGIN ISOLATION LEVEL READ COMMITTED라는 SQL Prepare Statement가 어플리케이션에서 발생하면서, 상당시간 SQL 지연이 지속되다가 실행된다. ISOLATION이란?ISOLATION은 ACID 의 일환 (Atomicity, Consistency, Isolation, Durability)이것은 트랜젝션 온전함을 다른 유저나 시스템에게 어떻게 공유할지에 대한 것을 결정한다.낮은 ISOLATION LEVEL은 같은 데이터에 동시에 많은 유저가 다룰수 있도록 하며(동시성을 높임) 다만 동시작업으로 발생할 수 있는 부차적인 문제가 발생한다.높은 ISOLATION LEVEL은 같은 데이터에 동시성을 낮추고, 시스템 부하를 높인다.DB SERVERSIDE 뿐만아니라 CLIEN..

Programming/Python 2024.06.13

Nori Tokenizer를 활용한 검색서버 개발

아래는 Nori Tokenizer를 활용한 검색서버개발 Git이다. https://github.com/armyost/elasticSearchEngine/tree/main GitHub - armyost/elasticSearchEngine Contribute to armyost/elasticSearchEngine development by creating an account on GitHub. github.com Tokenizer에 대한 자세한 설명은 다음을 참고한다. https://armyost.tistory.com/399 ElasticSearch 의 Tokenizer와 Text Analyze 에 대해서 데이터 색인 과정에서 검색 기능에 가장 큰 영향을 미치는 단계가 Tokenizer이다. 데이터 분석 과..

Programming/Python 2023.10.23

ElasticSearch 406에러

Elasticsearch index() ERROR: ApiError(406, 'Content-Type header [application/vnd.elasticsearch+x-ndjson; compatible-with=8] is not supported', 'Content-Type header [application/vnd.elasticsearch+x-ndjson; compatible-with=8] is not supported') 라는 오류가 발생하였다. 알고보니 내가 올린 ElasticSearch 버전은 7이고, pip install 한 python module은 8버전 Client였다. 그래서 pip uninstall 후 pip install elasticsearch7 로 재설치 하였다.

Programming/Python 2023.10.19

SQLAlchemy Metadata로 테이블, 쿼리 개발. JOIN 샘플

SQLAlchemy에서 Table Join을 복잡하게 하는 경우가 많아, 가급적 쉬운 방법을 찾아보았다. 전체소스 코드 : https://github.com/armyost/hexagonalSample/tree/main GitHub - armyost/hexagonalSample: This is python Sample with Hexagonal Architecture This is python Sample with Hexagonal Architecture. Contribute to armyost/hexagonalSample development by creating an account on GitHub. github.com 1-1) src/app/domain/models/user.py 에 Class 모델 ..

Programming/Python 2023.10.17

Python 에서 pip install할때 발생하는 오류들

오류 /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. 해결방안 # yum -y install centos-release-scl # yum -y install devtoolset-7 # scl enable devtoolset-7 bash 위 내용 미적용 시 에러 발생 :

Programming/Python 2023.03.21

(Python) Pytest로 Unit-test 구현하기

소스 다운로드 : https://github.com/armyost/miniterWithPytest.git armyost/miniterWithPytest This is frame of twitter back-end. Sign-up, Login with JWT, Follow, Unfollow, tweet. And it has pytest also(/test). MVC model project - armyost/miniterWithPytest github.com unit test는 UI test 나 integration test처럼 시스템을 실제로 실행하여 테스트를 진행하는 방식과는 많이 다르다. unit test는 코드를 테스트하는 개념이다. 우선 가상환경에서 pip로 pytest 모듈을 설치하자. pip ..

Programming/Python 2021.05.31

(Python) 트위터 메인프레임만들기

소스 다운로드 : https://github.com/armyost/miniterWithPytest.git armyost/miniter flask를 사용한 백엔드 1. Contribute to armyost/miniter development by creating an account on GitHub. github.com app.py를 실행시키면 완성본이 실행됩니다. 기능은 회원가입, 팔로우/언팔로우, 트윗, 타임라인 입니다. Python에서 Contoller는 다음과 같이 구현됩니다. @app.route("/signup",method=['POST']) def signup(): // 함수정의 Flask가 받은 Json을 파싱하여 사용하는 것은 간단하다. @app.route("/signup",method=[..

Programming/Python 2021.05.04

깔끔한 파이썬 탄탄한 백엔드 2. HTTP 구조와 이해 - 비제이퍼블릭

HTTP는 웹상에서 서로 다른 서버 간에 하이퍼텍스트 문서, 즉 HTML을 서로 주고받을 수 있도록 만들어진 프로토콜, 통신 규약이다. 웹상에서 네트워크를 통해 서버 사이에 통신할 때 어떠한 형식으로 서로 통신하자고 규정해 놓은 "통신 형식" 혹은 "통신 구조"라고 보면 된다. HTTP 통신 방식에는 2가지 특징이 있다. 하나는 HTTP의 요청과 응답 방식이고 또 다른 특징은 stateless다. HTTP 요청과 응답 먼저 HTTP 프로토콜에 대해서 이해해야 할 것은, HTTP는 기본적으로 요청과 응답의 구조로 되어 있다는 것이다. HTTP를 기반으로 통신할때 클라이언트가 먼저 HTTP 요청을 서버에 보내면 서버는 요청을 처리한 후 결과에 따른 HTTP응답을 클라이언트에게 보냄으로써 하나의 HTTP 통신..

Programming/Python 2021.05.02

깔끔한 파이썬 탄탄한 백엔드 1. 환경 설치 - 비제이퍼블릭

Flask Flask는 파이썬으로 웹 에플리케이션을 구현할 때 사용되는 프레임워크다. Flask의 홈페이지에 나온 공식적인 설명은 "micro web framework"이다. 즉 군더더기가 없는 아주 가벼운 웹 프레임워크라는 뜻이다. 파이썬 기반의 웹프레임워크에는 Flask 이외에도 Django등 다른 여러 웹 프레임워크가 있다. 하지만 다른 웹프레임워크들은 여러 모듈과 기능들을 제공하느라 프레임워크 자체가 무겁고, 학습곡선이 높을수 있는데 비해 Flask는 비교적 쉽게 배워서 사용할 수 있다. Flask 설치 Flask는 pip을 통해서 간단하게 설치할 수 있다. pip는 파이썬의 패키지 메니저다. pip를 사용하여 터미널 등의 커맨드라인 환경에서 간단하게 원한는 파이썬 패키지들을 설치할 수 있다. c..

Programming/Python 2021.05.02