Created
June 22, 2019 05:19
-
-
Save yuzutas0/d4f6a19eb9cbafb5415be2468f9e2e88 to your computer and use it in GitHub Desktop.
ETL Logic: MySQL TSV Dump -> BigQuery by Python3.5 Dataflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
magic_word = '{{{{{converted_by_yuzutas0_dataflow}}}}}' | |
text = text.replace('\\\"', '\"\"').replace('\\\\', magic_word) \ | |
.replace('\\\"', '\\').replace(magic_word, '\\\\') | |
text = re.sub(r'\\$', '', text, flags=re.MULTILINE) | |
if text.startswith('""') and not text.startswith('"""'): | |
text = text[1:] | |
if text.endswith('""') and not text.endswith('"""'): | |
text = text[0:-1] | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment