티스토리 뷰프로그래머 면접 신입 편 바로가기 Show 짧은 경력이지만, 인터뷰어로 참여한 경험을 바탕으로 안타까운 구직자들의 현실을 기록합니다.
지금 이 시간에도 구직 활동으로 정신 없을 많은 프로그래머가.. 부디 본인에게 맞는 회사에 취직해서 능력을 백 분 발휘하기를 기대합니다. 어제 데이터 엔지니어 직무로 면접을 봤다.
나는 MySQLToS3Operator를 사용할때는 S3 key가 있으면 MySQLToS3Operator가 동작하지 않는다고 생각했었다.. 그런데 오늘 소스코드를 뜯어보니 replace 파라미터가 있었고,
1. airflow.providers.amazon.aws.transfers.mysql_to_s3A. 공식 Documentairflow.providers.amazon.aws.transfers.mysql_to_s3 — apache-airflow-providers-amazon Documentation 위 document를 보면 B. Source Code
소스코드를 열어보니 그리고 MySQLToS3Operator class가 SqlToS3Operator를 상속받고 있는 것을 알 수 있다. 2. airflow.providers.amazon.aws.transfers.sql_to_s3A. 공식 Documentairflow.providers.amazon.aws.transfers.sql_to_s3 — apache-airflow-providers-amazon Documentation a. Classes
b. Attributes
c. Inheritance Structure
d. more informationSQL to Amazon S3 Transfer Operator — apache-airflow-providers-amazon Documentation SqlToS3Operator를 사용하여 SQL server로부터 Amazon S3 file로 data를 copy한다. SQL hook이 SQL 결과를 pandas dataframe으로 변환하는 function이 있는 한, 어느 SQL connection도 SqlToS3Operator는 호환된다. ㄱ) Prerequisite Tasks
ㄴ) MySQL to Amazon S3MySQL query에 대한 응답을 Amazon S3 file로 보내는 예제
e. Parametersquery: str
s3_bucket: str
s3_key: str
replace: bool
sql_conn_id: str
parameters: (Union[None, Mapping, Iterable])
aws_conn_id: str
verify: Optional[Union[bool, str]]
file_format: typing_extensions.Literal[csv, json, parquet]
pd_kwargs: Optional[dict]
f. Fieldtemplate_fields: Sequence[str]
template_ext: Sequence[str]
template_fields_renderers
g. Methodexecute(self, context)이것은 operator를 생성할때 파생되는 main method이다. Context는 jinka templates를 rendering할 때와 동일한 dictionary이다. 더 많은 context는 get_template_context를 참고하라. 이 context가 pythonOperator에서 python_callable로 입력되는 함수의 B. Source Codea. AttributesFILT_FORMAT
FileOptions
FILE_OPTIONS_MAP
b. ClassesSqlToS3Operator
BaseOperator를 상속받는다. c. Methodexecute
execute method는 BaseOperator class의 execute를 overriding한 것이다.
_get_hook
Database의 connection을 얻어오고 hook을 얻어온다. 얻어온
hook을 반환한다. execute Method에서 호출된다. _fix_int_dtypes
staticmethod라서 클래스 변수인 self를 사용하지 않았다. 따로 return값은 없는데, 여기에서 pandas의 DataFrame은 mutable한 성질이 있음을 알 수 있다.
|