By Reed Carter
- Python (BeautifulSoup, Pandas, Selenium, pyarrow)
- Airflow (via Docker)
- Google Cloud Platform (BigQuery, Looker Studio)
- SQL
Clone repo to your local system:
-
Make a directory on your disk where you would like to clone the repo.
-
Copy the repo link: https://github.com/Reed-Carter/Climate-Comparison-data (available if you click the green "Code" dropdown button on this page).
-
Open your terminal and change into the directory you made (
cd /path/to/new/directory
). -
Type
git clone
and paste the URL.
Install required packages:
These installation instructions assume you have pip, virtualenv, and Docker Desktop installed.
# Create and activate virtual environment
virtualenv -p python3.7 venv
source venv/bin/activate
# Install packages from requirements.txt
pip install -r requirements.txt
# Install Airflow
AIRFLOW_VERSION=2.3.2
PYTHON_VERSION=3.7
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
pip install "apache-airflow[async,postgres,google]==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"
You can create your own airflow directory in the root of this repository and copy any of our DAGs into it if you are interested in running them for yourself.
# Make and change to airflow subdirectory
mkdir airflow && cd "_$"
mkdir ./dags ./plugins ./logs # create subdirectories
# Download docker-compose.yaml and set the .env
curl -LfO 'https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml'
echo -e "AIRFLOW_UID=$(id -u)\nAIRFLOW_GID=0" > .env
Prior to initializing Airflow in Docker, you will need to create a project and an associated service account in BigQuery. After downloading the account's credential file, you can configure your docker-compose.yaml
to connect to BigQuery:
GOOGLE_APPLICATION_CREDENTIALS: /google_creds/<name-of-your-creds-file>.json
volumes:
- ${AIRFLOW_PROJ_DIR:-.}/dags:/opt/airflow/dags
- ${AIRFLOW_PROJ_DIR:-.}/logs:/opt/airflow/logs
- ${AIRFLOW_PROJ_DIR:-.}/plugins:/opt/airflow/plugins
- ${AIRFLOW_PROJ_DIR:-.}/data:/opt/airflow/data
- </path/to/your/creds/directory>:/google_creds
After opening Docker Desktop (or starting docker via CLI):
# Create and start Docker container from airflow-init image
docker compose up airflow-init
docker compose up
- No known bugs
MIT License
Copyright (c) 2023 Alejandro Socarras, Drew White, Reed Carter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.