python
-
PrefectPython 2023. 11. 8. 21:54
파이썬과 Prefect를 이용한 배치 프로세스 자동화 Prefect를 사용하여 데이터 워크플로우를 자동화하고 관리하는 방법을 알아봅시다. Prefect란 무엇인가? Prefect는 파이썬으로 구축된 현대적인 워크플로우 오케스트레이션 플랫폼입니다. 데이터 워크플로우를 자동화하고, 조정하며, 모니터링하는 것을 목적으로 설계되었습니다. Prefect는 배치 프로세스를 스케줄링하고, 데이터 파이프라인이 원활하게 실행되도록 보장하며, 오류를 우아하게 처리하는 데 이상적입니다. 시나리오: 엑셀 데이터 처리 및 API 요청 이 시나리오에서는 엑셀 파일에서 데이터를 로드하고, API에 POST 요청을 하는 배치 프로세스를 자동화하는 방법을 Prefect를 사용하여 다루게 됩니다. 다음과 같은 단계를 포함합니다: 엑셀 ..
-
Start Django project with Python DI manager poetryPython 2021. 8. 22. 12:49
Poetry 설치 공식 문서 참고 Introduction | Documentation | Poetry - Python dependency management and packaging made easy Using alternative installation methods will make Poetry always use the Python version for which it has been installed to create virtualenvs. So, you will need to install Poetry for each Python version you want to use and switch between them. python-poetry.org 프로젝트 디렉터리 생성 mkdir goboard..
-
python data classPython 2020. 1. 19. 23:36
"""" 클래스를 정의 할때 __init__ 에서 속성을 정의 하게 된다. 해당 속성이 많아질수록 불편 할 수 있다. dataclass 를 사용하여 타입 힌드만 작성 하도록 함으로써 객체의 속성을 자동으로 생성 하도록 할 수 있다. """" from dataclasses import dataclass class Person_01: def __init__(self, name, age): self.name = name self.age = name # dataclass 를 활용 해보도록 한다. # 초기화 함수를 가진 클래스를 자동으로 만들어준다. @dataclass class Person_02: name: str age: int #init -> 초기화 함수 #repr -> 런타임환경에서 출력 #eq -> 객체..
-
Python application with Docker Image build and RunPython 2019. 7. 14. 16:34
- create python app - (app.py) """ 샘플 app.py 에서는 아래 lib 가 필요 없으나, lib 설치 예시를 위해 작성 한것. """ import aiohttp import yaml from aiohttp import ClientSession from bs4 import BeautifulSoup import asyncio def hello(_str): print(_str) if __name__ == '__main__': hello("Hello! Docker") - created requirements.txt aiohttp==3.5.4 beautifulsoup4==4.7.1 PyYAML==5.1.1 - created Dockerfile - (DockerFile) # 파이썬 3...
-
-
python 다중 상속Python 2019. 1. 6. 15:42
""" 다중 상속 """ class Person(object): def talk(self): print('talk') def run(self): print('person run') class Car(object): def run(self): print('car run') # 다중 상속시 왼쪽부터 적용 된다, 메서드 오버라이드시 순서가 왼쪽부터 한번만 호출 된다. # class Robot(Person, Car): class Robot(Car, Person): def fly(self): print('fly') robot = Robot() robot.talk() robot.run() robot.fly()
-
python classPython 2019. 1. 3. 00:35
""" - person class 를 extends 하여 baby 와 adult class 를 만든다. - person class 는 기본적으로 age 속성을 가진다. - person class 는 drive 기능을 가지고 있다. * 18세 이상이면 운전이 가능 하며, 아니면 운정을 할 수 없다. - baby class 의 age 값은 18 이하 여야 한다. - adult class 의 age 값은 18 이상이어야 한다. - 자동차 클래스는 모델 과 running, ride 기능을 가지고 있다. -- ride 는 person 객체를 인자로 받아 운전 기능을 수행 하도록 한다. """ ## Base class 가 될 person class class Person(object): def __init__(se..
-
Python BasicPython 2019. 1. 1. 15:07
#>>>>>>>>>>>>>>>> [인자값을 tuple 로 받기] def say_hello(*params): # print(params) for param in params: print(param) say_hello('hi','world','gavin') myParams = ('hello','gavin','kim') say_hello(*myParams) # [인자값을 dictionary 로 받기] def menu(**kwargs): # print(kwargs) for k,v in kwargs.items(): print(k,v) menu(eat = 'beef',drink='coffee') myDic = { 'eat':'beef', 'drink' : 'latte', 'dessert':'banana' } men..
-
flask-web develope카테고리 없음 2016. 4. 2. 19:15
flask 로 개발할 웹 페이지는 대략 아래와 같다.1. 회원가입2. 로그인3. 메시지 쓰기4. 메시지에 코멘트 달기 데이터베이스 다이어그램은 아래와 같다. 먼저 mysql connection 을위한 설정을 한다. sudo -H pip install --allow-external mysql-connector-python-rf mysql-connector-python-rf mysql connetion.py 에 데이터 베이스 연결 설정을 한다.import mysql.connectorimport collections def _convert(data): if isinstance(data, basestring): return str(data) elif isinstance(data, collections.Mappi..