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 json | |
from time import sleep | |
from requests_oauthlib import OAuth1Session | |
CK = "" | |
CS = "" | |
AT = "" | |
ATS = "" |
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
from airflow import DAG | |
from airflow.operators.python import PythonOperator | |
from airflow.operators.bash import BashOperator | |
from datetime import datetime | |
def test_func(): | |
print('Hello from test_func') | |
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
def convert_pref(pref): | |
if pref=='茨城': | |
return 'ibaraki' | |
elif pref=='岐阜': | |
return 'gifu' | |
elif pref=='静岡': | |
return 'shizuoka' | |
elif pref=='千葉': | |
return 'chiba' | |
elif pref=='大阪': |
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 os | |
import datetime | |
from airflow import DAG | |
from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator | |
default_args = { | |
"start_date": datetime.datetime(2018, 1, 1), | |
} |
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
from airflow import DAG | |
from airflow.operators.bash_operator import BashOperator | |
from airflow.operators.python_operator import PythonOperator | |
import os | |
import datetime | |
import slackweb | |
WEBHOOK_URL = os.environ["WEBHOOK_URL"] | |
AIRFLOW_URL = os.environ["AIRFLOW_URL"] |
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 datetime | |
import os | |
import pandas as pd | |
import pytz | |
ZENGIN_JSON_PATH = "https://raw.githubusercontent.com/zengin-code/source-data/master/data/banks.json" | |
zengin = pd.read_json(ZENGIN_JSON_PATH) | |
zengin = zengin.T[["code", "name", "hira", "kana", "roma"]] |
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
steps: | |
# Access the id_github file from Secret Manager | |
- name: gcr.io/cloud-builders/gcloud | |
entrypoint: 'bash' | |
args: [ '-c', 'gcloud secrets versions access latest --secret=github-access-token > /root/github-access-token' ] | |
volumes: | |
- name: 'vol' | |
path: /root/ |
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
from airflow import DAG | |
from airflow.models import Variable | |
from airflow.utils.dates import days_ago | |
from airflow.contrib.operators.pubsub_operator import ( | |
PubSubPublishOperator, | |
PubSubSubscriptionCreateOperator, | |
PubSubSubscriptionDeleteOperator, | |
PubSubTopicCreateOperator, | |
PubSubTopicDeleteOperator | |
) |
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
from googleapiclient import discovery | |
PROJECT_ID = "your-project" | |
build_id = "youru-build-id" | |
cloudbuild = discovery.build("cloudbuild", "v1", cache_discovery=False) | |
request = cloudbuild.projects().builds().get(id=build_id, projectId=PROJECT_ID) | |
res = request.execute() | |
print(res) |
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 requests | |
address = "東京都千代田区千代田" | |
api_key = "" | |
requestUrl = f'https://maps.googleapis.com/maps/api/geocode/json?address="{address}"&key={api_key}&sensor=false' | |
r = requests.get(requestUrl).json() | |
if(r['results'] == []): | |
print("non result") |