본문 바로가기

반응형

Python

(52)
[Python] SqlAlchemy 유용한 문법 (기초~중급?) ★ sqlalchemy를 더욱 더 활용하는 방법★ ☆ 본 sample 코드들은 실행은 해보지 않았으니 참고용으로만 사용하시기 바랍니다.☆ ※ SQL에 대한 이해도가 낮은 경우 이해가 안될 수 있습니다. ※ > 질문은 언제나 환영합니다
[SQLAlchemy] schema에 따라 객체 변형해서 담기 router 한땀한땀 넣기 # router # 별로 없을때, 한땀한땀 넣기 @router.get("/{report_id}", response_model=schemas.Report) def report_read(report_id:int): report = (db.query(models.report, models.user.name.label("writer")) .join(models.user, models.report.writer == models.id) .first()) return schemas.test( id=report.id, title=report.name, contents=report.contents, comment=schemas.childComment.from_orm(report.comment)..
[Python] fastapi 파일 업로드 & data fastapi로 파일을 받고 json 데이터도 받고 싶었다. 근데 안된단다... 그걸 모르고 열심히 삽질했다. 422 Error value is not a valid dict FormData([('files', ), ( 'new_report', '{\r\n "name": "test.jpeg"\r\n,"owner": "test11"\r\n}')]) 안되는 이유는 아래와 같다. 다수의 File과 Form 매개변수를 한 경로 작동에 선언하는 것이 가능하지만, 요청의 본문이 application/json가 아닌 multipart/form-data로 인코딩 되기 때문에 JSON으로 받아야하는 Body 필드를 함께 선언할 수는 없습니다. 이는 FastAPI의 한계가 아니라, HTTP 프로토콜에 의한 것입니다. ht..
[python] pip install mariadb - E: Package 'python-dev' has no installation candidate (feat. ubuntu) Error Downloading mariadb-1.0.3.tar.gz (66 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.6/66.6 KB 4.8 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Skipping wheel build for mariadb, due to binaries being disabled for it. Installing collected packages: mariadb Running setup.py install for mariadb ... error error: subprocess-exited-with-error × Running setup.py install for mariadb did..
[Python] python3 가상환경 만들기 error error Error: Command ‘[‘/home/test/env/bin/python3’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 해결 --without-pip 옵션을 준다. python3 -m venv 경로명 --without-pip 다른 error https://24hours-beginner.tistory.com/446 [Python] python3 -m venv .venv error (feat. ubuntu) 아래 처럼 venv로 가상환경을 만드려고 했는데 에러가 났다. root:/test# python3 -m venv .venv The virtual environment was not crea..
[Python] python3.8 install (feat. Docker / ubuntu) 도커 컨테이너 ubuntu 환경에 python 3.8 install 하기 https://heekangpark.github.io/python/02-installation 파이썬 설치하기 Reinventing the Wheel heekangpark.github.io apt update apt -y install software-properties-common Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of cities, representing the time zones in which they are located. 1..
[Python] pip install mariadb - MariaDB Connector/Python requires MariaDB Connector/C >= 3.3.1, found version 3.1.20 (feat. ubuntu / Docker) 다른에러에서 oserror 해결하고 오니까 또 에러가 난다. Error pip install mariadb Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com /usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/connectionpool.py:999: InsecureRequestWarning: Unverified HTTPS request is being made to host 'pypi.ngc.nvidia.com'. Adding certificate verification is strongly advised. See: https://urllib3.readt..
[Python] python3 -m venv .venv error (feat. ubuntu) error 아래 처럼 venv로 가상환경을 만드려고 했는데 에러가 났다. root:/test# python3 -m venv .venv The virtual environment was not created successfully because ensurepip is not available. On Debian/Ubuntu systems, you need to install the python3-venv package using the following command. apt install python3.8-venv You may need to use sudo with that command. After installing the python3-venv package, recreate your virtua..

반응형