분류 전체보기
GCP15 :: Apache-Beam ParDo
GCP15 :: Apache-Beam ParDo
2020.08.20최근에 로컬에서 환경과 클라우드 환경에서의 결과값이 다르게 나와서 stackoverflow 에 질문을 올린적이 있다. https://stackoverflow.com/questions/63460701/in-the-local-environment-the-result-value-and-the-dataflow-result-values-are-di/63465435?noredirect=1#comment112262586_63465435 In the local environment, the result value and the dataflow result values are different Here is my input data. ㅡ.Input(Local) 'Iot,c c++ python,2015', 'Web,jav..
Linux02 :: 변수 생성하기
Linux02 :: 변수 생성하기
2020.08.19export BUCKET_NAME="bucket-name" echo BUCKET_NAME //result -> bucket-name
Linux01 :: 리눅스 grep 명령어
Linux01 :: 리눅스 grep 명령어
2020.08.19grep은 입력으로 전달된 파일의 내용중에서 특정 문자열을 찾고자할때 사용합니다. 내부적으로 문자열 매칭이 아니라 정규 표현식을 사용하는 패턴매칭을 수행합니다. $ grep [OPTION] [PATTERN] [FILE] e.g File = "hi name" cat File.txt #result hi name grep "hi" File.txt #result hi name (hi를 찾아줍니다.)
알고리즘94 :: BOJ_1012_유기농배추
알고리즘94 :: BOJ_1012_유기농배추
2020.08.191 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 package backjun; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class backjun_1012_유기농배추 { static int[][] map; static int[] dx= {-1,1,0,0}; stat..
Python11 :: python 문법, 요약
Python11 :: python 문법, 요약
2020.08.19ㅡ. 인덴트 공백을 추가합니다. (보통 4칸) ㅡ. 네이밍 컨벤션 스네이크 케이스 e.g) hi_naming PEP 8 철학에 따라 스네이크 코딩을 지향합니다. ㅡ. 타입 에러 타입 에러 발생시 Incompatible return value type 에러가 발생합니다. ㅡ. 리스트 컴프리헨션 map, filter, 람다를 지원합니다. print([n*3 for n in range(1, 10+1) if n%2 == 1]) #result [3, 9, 15, 21, 27] 가독성이 좋아집니다. ㅡ. 제너레이터 return 은 함수가 종료되는데 비해 yield는 실행 중이던 값을 내보내게 됩니다. 다음 값을 생성하기 위해서는 next를 사용합니다. #print([n*3 for n in range(1, 10+1)..
알고리즘93 :: 릿코드 시작
알고리즘93 :: 릿코드 시작
2020.08.19https://leetcode.com/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 에시 시작합니다.
GCP14 :: streaming 데이터 처리
GCP14 :: streaming 데이터 처리
2020.08.18ㅡ. 시작 클라우드 pub/sub 을 이용합니다. (서버리스 실시간 메시지 서비스) 클라우드 pub/sub 의 기능은 초당 백만 개 이상의 메시지로 확장시킬 수 있습니다. 전체 데이터 플로우는 빅쿼리 이벤트 테이블에서 데이터를 읽어들여서 클라우드 pub/sub로 메시지를 송신하는 것을 의미합니다. pub/sub으로 전송되는 코드가 실패할경우에 자동으로 재시작할 수 있도록 구글 컨테이너 엔진을 사용해 도커 컨테이너에서 시뮬레이션을 스크립트를 다시 재시작 해야 합니다. ㅡ. workflow bigQuery에서 데이터를 불러와서 topic에 넣고 subscription 에서는 topic의 내용을 받아와서 dataflow로 ETL처리후에 bigQuery로 내보내는 과정을 수행합니다. ㅡ. 정지시간 pub/sub..
GCP13 :: dataflow Map 활용, Lambda
GCP13 :: dataflow Map 활용, Lambda
2020.08.18Lambda 를 사용하기 전 import apache_beam as beam def strip_header_and_newline(text): return text.strip('\n') def strip_header_and_newline2(text): return text.strip('#') with beam.Pipeline() as pipeline: plants = ( pipeline | 'Gardening plants' >> beam.Create([ '# 🍓Strawberry\n', '# 🥕Carrot\n', '# 🍆Eggplant\n', '# 🍅Tomato\n', '# 🥔Potato\n', ]) | 'Strip header' >> beam.Map(strip_header_and_newline) #| '..
GCP12 :: Apache Beam, Map() vs FlatMap()
GCP12 :: Apache Beam, Map() vs FlatMap()
2020.08.15ㅡ. Map() vs FlatMap() Map() 에서는 Input 과 Output 이 일대일 관계로 나타나 있습니다. FlatMap() 에서는 Input 에 대해 여러개의 출력을 반환할 수 있습니다. 또한, FlatMap() 과 함께 사용되는 yield 키워드는 더이상 반환할 데이터가 없을 때까지 한번, 하나 데이터를 반환하게 됩니다. 위 메소드는 병렬처리할 때 방법이 서로 다릅니다.
Python09 :: python format, join
Python09 :: python format, join
2020.08.15format 문자열 포맷을 결정할 수 있습니다. count = 5 print("run {} program".format(count)) #result1 : run 5 program join alphabet = ['a', 'b', 'c', 'd', 'e'] print (",".join(alphabet)) print ("\n".join(alphabet)) #result1 : a,b,c,d,e #result2 : a b c d e join을 수행하면 문자열 뒤에 지정한 형식의 구분자가 포함되게 됩니다.
GCP11 :: Google Cloud Platform 명령어 정리
GCP11 :: Google Cloud Platform 명령어 정리
2020.08.15Google Cloud Platform 관련 실습을 진행하다 모르는 명령어 관련 정리 하고자 합니다. 1) bq mk flights bq 명령줄 도구를 사용해서 쿼리를 실행하고 데이터를 로드할 수 있습니다. e.g) bq mk new_dataset or bq mk new_dataset.new_table --bq help CLI 명령어로 쳐보면 mk는 Create a dataset, table, view, or transfer configuration with this name 으로 설명되어 있습니다. --bq help load 에서 구체적인 스키마에 관련된 정보를 확인해볼 수 있습니다.
Python08 :: python csv format 만들기
Python08 :: python csv format 만들기
2020.08.15import io import csv output = io.StringIO() csvdata = [1,2,'abc market','hi everyone','common'] writer = csv.writer(output,quoting=csv.QUOTE_NONNUMERIC) writer.writerow(csvdata) print(type(output.getvalue())) print(output.getvalue()) result #str #1,2,"abc market","hi everyone","common"