몰라그거무서운거/기타등등

airflow 메모 - 코드조각

reyoucat 2017. 12. 7. 14:46

airflow Variable, Connections 암호화 하는 법.

airflow.cfg


# Secret key to save connection passwords in the db
fernet_key = cryptography_not_found_storing_passwords_in_plain_text


fernet_key를 저부분에 생성해서 넣으면 됨.


주의1 ::: 이후 한글키나 한글값을 저장하면 다음과 같은 오류가 남.

알아서 코드나 디비를 수정 하길... 바람. 참고주소 https://libsora.so/posts/python-hangul/

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 0: ordinal
not in range(128)


주의2 ::: 이전에 만든키는 그냥 일반키이다.


fernet_key 만든는 방법. 

$ pip install cryptography

안깔려 있으니 설치 한다. (  https://cryptography.io/en/latest/installation/  )


$ python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print FERNET_KEY"


콘솔창에 치면 다음줄에 키값이 떨어질텐데 이걸 위에 넣으면 됨.


..



hook

http://tech.marksblogg.com/airflow-postgres-redis-forex.html